mirror of
https://github.com/snoyberg/keter.git
synced 2024-12-14 17:12:46 +03:00
Fix websockets example build.
This commit is contained in:
parent
f73af18343
commit
98827e1e36
@ -11,7 +11,7 @@ PKGCONF = ../cabal.sandbox.config
|
||||
CABAL_ARGS = --sandbox-config-file=$(PKGCONF)
|
||||
|
||||
|
||||
all: foo.keter foo1_0.keter
|
||||
all: foo.keter foo1_0.keter websockets
|
||||
.PHONY: all
|
||||
|
||||
# Simple targets
|
||||
@ -36,16 +36,17 @@ foo1_0.keter: ./foo1_0/*.hs ./foo1_0/config/*.yaml
|
||||
cd foo1_0; tar czfv ../foo1_0.keter *
|
||||
|
||||
|
||||
# websockets needs Yesod and Conduit
|
||||
# websockets needs extra dependencies:
|
||||
#
|
||||
# $ cabal install yesod-websockets lifted-base
|
||||
websockets.keter: ./websockets/*.hs ./websockets/config/*.yaml
|
||||
@echo "Building websockets example."
|
||||
$(CABAL) $(CABAL_ARGS) exec $(GHC) -- --make ./websockets/chat.hs
|
||||
strip ./websockets/chat
|
||||
tar czfv websockets.keter chat config/keter.yaml
|
||||
cd websockets; tar czfv ../websockets.keter *
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *.keter
|
||||
find . -type f -name '*.keter' -delete
|
||||
find . -type f -name '*.hi' -delete
|
||||
find . -type f -name '*.o' -delete
|
||||
|
@ -6,7 +6,8 @@ import Control.Monad (forever)
|
||||
import Control.Monad.Trans.Reader
|
||||
import Control.Concurrent (threadDelay)
|
||||
import Data.Time
|
||||
import Conduit
|
||||
import Data.Conduit
|
||||
import qualified Data.Conduit.List as CL
|
||||
import Data.Monoid ((<>))
|
||||
import Control.Concurrent.STM.Lifted
|
||||
import Data.Text (Text)
|
||||
@ -30,7 +31,7 @@ chatApp = do
|
||||
dupTChan writeChan
|
||||
race_
|
||||
(forever $ atomically (readTChan readChan) >>= sendTextData)
|
||||
(sourceWS $$ mapM_C (\msg ->
|
||||
(sourceWS $$ CL.mapM_ (\msg ->
|
||||
atomically $ writeTChan writeChan $ name <> ": " <> msg))
|
||||
|
||||
getHomeR :: Handler Html
|
||||
|
Loading…
Reference in New Issue
Block a user