Created
April 27, 2011 23:19
-
-
Save ktvoelker/945452 to your computer and use it in GitHub Desktop.
Some record types
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
data Foo = Foo { a :: Int, b :: Int } | |
data Bar = Bar { x :: Foo, y :: Foo } |
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
one = modify $ \bar -> bar { x = (x bar) { a = 1 } } |
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
one = putf (x // a) 1 |
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
one = modify $ \foo -> foo { a = 1 } | |
one' = modify $ \bar -> bar { x = execState one $ x bar, y = execState one $ y bar } |
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
one = putf a 1 | |
one' = enter x one >> enter y one |
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
one' = modify $ \bar -> bar { x = x { a = 1 }, y = y { a = 1 } } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment