Last active
August 29, 2015 14:12
-
-
Save taksuyu/9d888bf4c2c3623a1c9d to your computer and use it in GitHub Desktop.
pattern matching a constructor
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 Test = Test | NotTest | StillNotTest deriving Show | |
testFuction a@Test {} = a | |
testFuction _ = NotTest | |
{- | |
Test -> Test | |
NotTest -> NotTest | |
StillNotTest -> NotTest | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment