mirror of
https://github.com/ilyakooo0/elm-bridge.git
synced 2024-09-11 22:07:09 +03:00
Haskell: Derive Elm types from Haskell types
app | ||
src | ||
test | ||
.gitignore | ||
.travis.yml | ||
elm-bridge.cabal | ||
LICENSE | ||
README.md | ||
Setup.hs | ||
stack.yaml |
Elm Bridge
Intro
Hackage: elm-bridge
WARNING: Work in progress!
Building the bridge from Haskell to Elm and back. Define types once, use on both sides and enjoy easy (de)serialisation. Cheers!
Usage
{-# LANGUAGE TemplateHaskell #-}
import Elm.Derive
import Elm.TyRender
import Elm.TyRep
import Data.Proxy
data Foo
= Foo
{ f_name :: String
, f_blablub :: Int
} deriving (Show, Eq)
main :: IO ()
main =
putStrLn $ renderElm $ compileElmDef (Proxy :: Proxy Foo)
Output will be:
type alias Foo =
{ f_name: String
, f_blablub: Int
}
For more usage examples check the tests.
Install
- Using cabal:
cabal install elm-bridge
- From Source:
git clone https://github.com/agrafix/elm-bridge.git && cd elm-bridge && cabal install
Todo
- Generate Elm JSON Serializer/Parser