tricu

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

main.tri (403B)


      1 !import base as B
      2 !import handlers as H
      3 !import handler_log as Log
      4 !export main
      5 
      6 -- Application code knows neither where logs go nor who supplies request context.
      7 application = do H.bind
      8   Log.info "starting"
      9   Log.info "finished"
     10   H.pure 42
     11 
     12 -- Pure: Result [42 events]. Put capture outside context so it sees enrichment.
     13 main = Log.withContext [["request" 7]] application |> Log.capture |> H.runPure