Skip to content

Instantly share code, notes, and snippets.

@dtoma
Last active May 1, 2019 09:14
Show Gist options
  • Save dtoma/39e0c58ea973ac7985f30fdb91f2648e to your computer and use it in GitHub Desktop.
Save dtoma/39e0c58ea973ac7985f30fdb91f2648e to your computer and use it in GitHub Desktop.
Haskell TIL

2019-04-12

  1. trace:

This will print p1 and p2 then return ()

Prelude Debug.Trace> myFunc p1 p2 = traceShow (p1, p2) ()
Prelude Debug.Trace> myFunc 1 2
(1,2)
()
  1. Visualize project dependencies with Stack

stack dot --external | dot -Tpng -odependencies.png

2019-05-01

WAI metrics (from this example):

-- | Return wai metrics as JSON
waiMetrics :: MonadIO m => AppT m (HashMap Text Int64)
waiMetrics = do
    increment "metrics"
    logDebugNS "web" "metrics"
    metr <- Metrics.getMetrics
    liftIO $ mapM Counter.read =<< readIORef (metr ^. metricsCounters)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment