tricu

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

bd4c05cd4169ed1d82714a61a87e446b4d6fcf567e9497abd923370175261346.tri (748B)


      1 !import base as B
      2 !import conversions as C
      3 !import io as IO
      4 !import arboricx_streaming 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.stdoutLog address 16 count ready)
     17 main = IO.io (Server.serve "./store" 1048576 Registry.stdoutLog (IO.ipv4 [127 0 0 1] 9050) 16 ready)