Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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