mirror of
https://github.com/typeable/wai.git
synced 2024-12-28 16:46:28 +03:00
adjust wai-extra example program
This commit is contained in:
parent
b7bf7c9138
commit
b2274a566d
@ -1,7 +1,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
module Main where
|
||||
|
||||
import Blaze.ByteString.Builder.Char.Utf8 (fromString)
|
||||
import Data.ByteString.Builder (string8)
|
||||
import Control.Concurrent (forkIO, threadDelay)
|
||||
import Control.Concurrent.Chan
|
||||
import Control.Monad
|
||||
@ -27,15 +27,15 @@ eventChan :: Chan ServerEvent -> IO ()
|
||||
eventChan chan = forever $ do
|
||||
threadDelay 1000000
|
||||
time <- getPOSIXTime
|
||||
writeChan chan (ServerEvent Nothing Nothing [fromString . show $ time])
|
||||
writeChan chan (ServerEvent Nothing Nothing [string8 . show $ time])
|
||||
|
||||
eventIO :: IO ServerEvent
|
||||
eventIO = do
|
||||
threadDelay 1000000
|
||||
time <- getPOSIXTime
|
||||
return $ ServerEvent (Just $ fromString "io")
|
||||
return $ ServerEvent (Just $ string8 "io")
|
||||
Nothing
|
||||
[fromString . show $ time]
|
||||
[string8 . show $ time]
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
|
Loading…
Reference in New Issue
Block a user