Skip to content

Instantly share code, notes, and snippets.

@baio
Created January 4, 2017 10:46
Show Gist options
  • Save baio/0eab0c2c1dcf4883de48298b0848f8f3 to your computer and use it in GitHub Desktop.
Save baio/0eab0c2c1dcf4883de48298b0848f8f3 to your computer and use it in GitHub Desktop.
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