Created
January 4, 2017 10:46
-
-
Save baio/0eab0c2c1dcf4883de48298b0848f8f3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
module Main where | |
import Prelude | |
type Geo = | |
{ | |
lat :: Number, | |
lon :: Number | |
} | |
type Address = | |
{ | |
index :: Int, | |
street :: String, | |
city :: String, | |
state :: String | |
} | |
data Contact = Email Address | Phone | |
showAddress :: Address -> String | |
showAddress addr = addr.street <> ", " <> | |
addr.city <> ", " <> | |
addr.state | |
address = {index: 0, street: "123 Fake St.", city: "Faketown", state: "CA" } | |
convert::Contact -> Int | |
convert (Email x) = x.index | |
convert Phone = 1 | |
x = convert (Email address) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment