Skip to content

Instantly share code, notes, and snippets.

@dlidstrom
Created December 13, 2018 10:26
Show Gist options
  • Save dlidstrom/9166b58f24ed4f0ccc2897b5c94351da to your computer and use it in GitHub Desktop.
Save dlidstrom/9166b58f24ed4f0ccc2897b5c94351da to your computer and use it in GitHub Desktop.
module Main where
import Prelude
type Student = {
first :: String,
last :: String,
class :: String
}
type GymMember = {
first :: String,
last :: String,
benchPressPB :: Int
}
daveG :: GymMember
daveG = {
first: "Dave",
last: "Bro",
benchPressPB: 300
}
philS :: Student
philS = {
first : "Dave",
last : "Swat",
class : "1A"
}
type NamedThing t =
{ last :: String
, first :: String
| t
}
schoolRollName :: forall t. NamedThing t -> String
schoolRollName rec = rec.last <> ", " <> rec.first
firstAndSurname :: forall t. NamedThing t -> String
firstAndSurname rec = rec.first <> " " <> rec.last
daveFandS :: String
daveFandS = firstAndSurname daveG
daveSR :: String
daveSR = schoolRollName daveG
philFandS :: String
philFandS = firstAndSurname philS
philSR :: String
philSR = schoolRollName philS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment