Created
December 13, 2018 10:26
-
-
Save dlidstrom/9166b58f24ed4f0ccc2897b5c94351da to your computer and use it in GitHub Desktop.
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
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