on 8bb1196 help sign in
typeable/wai/TestApp.hs
15 lines 505 B history raw
1{-# LANGUAGE OverloadedStrings #-}
2module TestApp (testApp) where
4import Network.Wai
5import Data.ByteString.Lazy.Char8 (pack)
6import Control.Concurrent.MVar
8testApp handler = do
9 putStrLn "testApp called, this should happen only once per reload"
10 var <- newMVar 0
11 handler $ const $ do
12 counter <- modifyMVar var $ \i -> return (i + 1, i + 1)
13 return $ Response status200
14 [("Content-Type", "text/plain")]
15 $ ResponseLBS $ pack $ "Counter: " ++ show counter