[server] Add ForkModule for combining other modules

This one has some interesting code in its constructor, using the Cont monad
because of the way the ModuleConstructor is structured.
This commit is contained in:
Joscha 2020-02-12 00:35:49 +00:00
parent d5d0fccdaf
commit 6d6344d372
4 changed files with 100 additions and 12 deletions

View file

@ -1,9 +1,13 @@
{-# LANGUAGE OverloadedStrings #-}
module Main where
import qualified Network.WebSockets as WS
import qualified Network.WebSockets as WS
import Forest.Server
import Forest.TreeModule.ConstModule
import Forest.Server
import Forest.Node
import Forest.TreeModule.ConstModule
import Forest.TreeModule.ForkModule
pingDelay :: Int
pingDelay = 10
@ -19,4 +23,7 @@ options = WS.defaultServerOptions
main :: IO ()
main = do
putStrLn "Starting server"
WS.runServerWithOptions options $ serverApp pingDelay $ constModule projectDescriptionNode
WS.runServerWithOptions options $ serverApp pingDelay $ forkModule "Forest"
[ ProngConstructor $ constModule $ newNode "" "Test" [txtNode "" "Bla"]
, ProngConstructor $ constModule projectDescriptionNode
]