Created
February 18, 2015 20:41
-
-
Save queertypes/2ea9b69bea946cb93e95 to your computer and use it in GitHub Desktop.
Record partial application in Haskell
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
> data Thing = Thing {a :: Int, b :: Int, c :: Int} deriving Show | |
> :t | |
Thing :: Int -> Int -> Int -> Thing | |
> Thing {a = 10} | |
<interactive>:13:1: Warning: | |
Fields of ‘Thing’ not initialised: b, c | |
In the expression: Thing {a = 10} | |
In an equation for ‘it’: it = Thing {a = 10} | |
<interactive>:13:1: Warning: | |
Fields of ‘Thing’ not initialised: b, c | |
In the expression: Thing {a = 10} | |
In an equation for ‘it’: it = Thing {a = 10} | |
Thing {a = 10, b = *** Exception: <interactive>:13:1-14: Missing field in record construction Ghci4.b | |
> Thing {c = 10} {a = 5} {b = 2} | |
<interactive>:14:1: Warning: | |
Fields of ‘Thing’ not initialised: a, b | |
In the expression: Thing {c = 10} | |
In the expression: (Thing {c = 10}) {a = 5} | |
In the expression: ((Thing {c = 10}) {a = 5}) {b = 2} | |
<interactive>:14:1: Warning: | |
Fields of ‘Thing’ not initialised: a, b | |
In the expression: Thing {c = 10} | |
In the expression: (Thing {c = 10}) {a = 5} | |
In the expression: ((Thing {c = 10}) {a = 5}) {b = 2} | |
Thing {a = 5, b = 2, c = 10} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment