tricu

A lazy functional language based on Tree Calculus
Log | Files | Refs | README | LICENSE

bc09110023edc9a6aa7d947e51a09385f600d4fef66e8fd765808ad14f7ecc34.tri (758B)


      1 !import base as B
      2 !import conversions as C
      3 !import io_v2 as IO
      4 !import arboricx_streaming_v2 as Server
      5 !import arboricx_handlers as Registry
      6 !export main
      7 !export server
      8 -- Native streaming registry with selectable address and connection count.
      9 -- Source-owned ./store, 1-MiB body/object budget and bounded FIFO16 admission.
     10 port ["ipv4" _ value] = value
     11 port _ = 0
     12 ready listener = do IO.require
     13   address <- IO.localAddress listener
     14   writer <- IO.stdout
     15   IO.require (IO.writeAll writer (B.append (C.showNumber (port address)) [10])) IO.pure
     16 server root address count = IO.io (Server.serveCount root 1048576 Registry.stdoutLogV2 address 16 count ready)
     17 main = IO.io (Server.serve "./store" 1048576 Registry.stdoutLogV2 (IO.ipv4 [127 0 0 1] 9050) 16 ready)