Created
March 3, 2012 06:55
-
-
Save krdlab/1964772 to your computer and use it in GitHub Desktop.
type definition by 'data' and 'newtype'
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 Hoge = Hoge { get :: Int } | |
foo :: Hoge -> String | |
foo (Hoge _) = "foo!" | |
foo undefined | |
-- "*** Exception: Prelude.undefined |
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
newtype Hoge = Hoge { get :: Int } | |
foo :: Hoge -> String | |
foo (Hoge _) = "foo!" | |
foo undefined | |
-- "foo!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment