[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

@ -8,9 +8,16 @@ import qualified Data.Text as T
import Forest.Node
class TreeModule a where
edit :: a -> Path -> T.Text -> IO ()
edit :: a -> Path -> T.Text -> IO ()
edit _ _ _ = pure ()
delete :: a -> Path -> IO ()
reply :: a -> Path -> T.Text -> IO ()
act :: a -> Path -> IO ()
delete _ _ = pure ()
reply :: a -> Path -> T.Text -> IO ()
reply _ _ _ = pure ()
act :: a -> Path -> IO ()
act _ _ = pure ()
type ModuleConstructor a = (Node -> IO ()) -> (a -> IO ()) -> IO ()