Haskell: Derive Elm types from Haskell types
Go to file
2015-08-09 22:29:07 +02:00
app first working prototype 2015-08-09 18:00:06 +02:00
src added json ser/parser and module gen 2015-08-09 22:29:07 +02:00
test added json ser/parser and module gen 2015-08-09 22:29:07 +02:00
.gitignore first working prototype 2015-08-09 18:00:06 +02:00
.travis.yml drop ghc7.6 2015-08-09 19:12:53 +02:00
elm-bridge.cabal added json ser/parser and module gen 2015-08-09 22:29:07 +02:00
LICENSE first working prototype 2015-08-09 18:00:06 +02:00
README.md add readme 2015-08-09 18:43:46 +02:00
Setup.hs first working prototype 2015-08-09 18:00:06 +02:00
stack.yaml first working prototype 2015-08-09 18:00:06 +02:00

Elm Bridge

Build Status

Hackage Deps

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