aboutsummaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorJasper Van der Jeugt2020-07-28 23:25:57 +0200
committerJasper Van der Jeugt2020-07-28 23:25:57 +0200
commit125a792ec885d16fc0e41751d073caf2da9f2301 (patch)
tree607c34616ba7b6473b5a8ab1cf22c93acf78f292 /server
parentf9716e24c2b41cfc416e227b275e2ae15866a370 (diff)
Mess around
Diffstat (limited to 'server')
-rw-r--r--server/cafp.cabal41
-rw-r--r--server/src/GenerateElmTypes.hs13
-rw-r--r--server/src/GenerateTypes.hs4
3 files changed, 36 insertions, 22 deletions
diff --git a/server/cafp.cabal b/server/cafp.cabal
index 08b479c..fc52b4f 100644
--- a/server/cafp.cabal
+++ b/server/cafp.cabal
@@ -1,14 +1,14 @@
-Name: cafp
-Version: 0.1.0
-Synopsis: Cards Against Functional Programming
-License: BSD3
-License-file: LICENSE
-Author: Jasper Van der Jeugt <m@jaspervdj.be>
-Maintainer: Jasper Van der Jeugt <m@jaspervdj.be>
-Copyright: 2020 Jasper Van der Jeugt <m@jaspervdj.be>
-Category: Language
-Build-type: Simple
-Cabal-version: 1.18
+Name: cafp
+Version: 0.1.0
+Synopsis: Cards Against Functional Programming
+License: BSD3
+License-file: LICENSE
+Author: Jasper Van der Jeugt <m@jaspervdj.be>
+Maintainer: Jasper Van der Jeugt <m@jaspervdj.be>
+Copyright: 2020 Jasper Van der Jeugt <m@jaspervdj.be>
+Category: Language
+Build-type: Simple
+Cabal-version: 1.18
Library
Default-language: Haskell2010
@@ -19,11 +19,16 @@ Library
Cafp.Messages
Build-depends:
- base >= 4.9 && < 5
+ base >= 4.9 && < 5,
+ elm-bridge >= 0.5 && < 0.6
-Executable cafp-generate-types
- Hs-source-dirs: src
- Main-is: GenerateTypes.hs
- Default-language: Haskell2010
- Ghc-options: -Wall
- build-depends: base, cafp
+Executable cafp-generate-elm-types
+ Hs-source-dirs: src
+ Main-is: GenerateElmTypes.hs
+ Default-language: Haskell2010
+ Ghc-options: -Wall
+
+ Build-depends:
+ base >= 4.9 && < 5,
+ cafp,
+ elm-bridge >= 0.5 && < 0.6
diff --git a/server/src/GenerateElmTypes.hs b/server/src/GenerateElmTypes.hs
new file mode 100644
index 0000000..e8aa25b
--- /dev/null
+++ b/server/src/GenerateElmTypes.hs
@@ -0,0 +1,13 @@
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-# LANGUAGE TemplateHaskell #-}
+import Cafp.Messages
+import Elm.Derive
+import Elm.Module
+import Data.Proxy
+
+deriveBoth defaultOptions ''ServerMessage
+
+main :: IO ()
+main = putStrLn $ makeElmModule "Messages"
+ [ DefineElm (Proxy :: Proxy ServerMessage)
+ ]
diff --git a/server/src/GenerateTypes.hs b/server/src/GenerateTypes.hs
deleted file mode 100644
index 730d9fb..0000000
--- a/server/src/GenerateTypes.hs
+++ /dev/null
@@ -1,4 +0,0 @@
-import Cafp.Messages
-
-main :: IO ()
-main = print Welcome