[all] Reorganize haskell code into multiple packages

This commit is contained in:
Joscha 2020-03-14 01:02:57 +00:00
parent 0edc241149
commit 4b8d0ee4a4
37 changed files with 368 additions and 140 deletions

1
forest-cabin/README.md Normal file
View file

@ -0,0 +1 @@
# forest-cabin

37
forest-cabin/app/Main.hs Normal file
View file

@ -0,0 +1,37 @@
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Concurrent.MVar
import qualified Network.WebSockets as WS
import Forest.Node
import Forest.Server
import Forest.Server.Broadcast
import Forest.Server.TreeModule.Const
import Forest.Server.TreeModule.Fork
import Forest.Server.TreeModule.SharedEditing
pingDelay :: Int
pingDelay = 10
pongDelay :: Int
pongDelay = 3 * pingDelay
options :: WS.ServerOptions
options = WS.defaultServerOptions
{ WS.serverRequirePong = Just pongDelay
}
main :: IO ()
main = do
putStrLn "Preparing shared edit module"
sharedEditNodeVar <- newMVar $ txtNode "r" ""
sharedEditBroadcaster <- newBroadcaster
putStrLn "Starting server"
WS.runServerWithOptions options $ serverApp pingDelay $ forkModule "Forest"
[ ProngConstructor "Test" $ constModule $ newNode "" "" [txtNode "" "Bla"]
, ProngConstructor "Sandbox" $ sharedEditingModule sharedEditNodeVar sharedEditBroadcaster
, ProngConstructor "About" $ constModule projectDescriptionNode
]

View file

@ -0,0 +1,52 @@
cabal-version: 1.12
-- This file has been generated from package.yaml by hpack version 0.31.2.
--
-- see: https://github.com/sol/hpack
--
-- hash: c619b22393d818639b183c69031b267a4ed16faeaf609a75ef1cadb9288195e1
name: forest-cabin
version: 0.1.0.0
synopsis: A forest server hosted at forest.plugh.de
description: Please see the README at <https://github.com/Garmelon/forest#readme>
homepage: https://github.com/Garmelon/forest#readme
bug-reports: https://github.com/Garmelon/forest/issues
author: Garmelon <joscha@plugh.de>
maintainer: Garmelon <joscha@plugh.de>
copyright: 2020 Garmelon
license: MIT
build-type: Simple
extra-source-files:
README.md
source-repository head
type: git
location: https://github.com/Garmelon/forest
library
other-modules:
Paths_forest_cabin
hs-source-dirs:
src
build-depends:
base >=4.7 && <5
, forest-common
, forest-server
, websockets
default-language: Haskell2010
executable forest-cabin
main-is: Main.hs
other-modules:
Paths_forest_cabin
hs-source-dirs:
app
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends:
base >=4.7 && <5
, forest-cabin
, forest-common
, forest-server
, websockets
default-language: Haskell2010

32
forest-cabin/package.yaml Normal file
View file

@ -0,0 +1,32 @@
name: forest-cabin
version: 0.1.0.0
license: MIT
author: Garmelon <joscha@plugh.de>
copyright: 2020 Garmelon
synopsis: A forest server hosted at forest.plugh.de
description: Please see the README at <https://github.com/Garmelon/forest#readme>
github: Garmelon/forest
extra-source-files:
- README.md
dependencies:
- base >= 4.7 && < 5
- forest-common
- forest-server
- websockets
library:
source-dirs: src
executables:
forest-cabin:
source-dirs: app
main: Main.hs
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
dependencies:
- forest-cabin