Last active
January 25, 2016 19:34
-
-
Save fredcy/c02d5ecb50832f1ae6a2 to your computer and use it in GitHub Desktop.
Elm record usage example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Graphics.Element exposing (show) | |
type Foo = A { x : Int, y : String } | |
| B { x : Int, m : Float } | |
f : Foo -> Foo | |
f foo = | |
let | |
incr v = { v | x = v.x + 1 } | |
in | |
case foo of | |
A v -> A (incr v) | |
B v -> B (incr v) | |
main = | |
A { x = 3, y = "blah" } |> f |> show |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment