Created
February 6, 2015 12:32
-
-
Save joseanpg/8cf9bb323d7a3c3f1bf3 to your computer and use it in GitHub Desktop.
case everything
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
module Letiscase where | |
data Tipo = TipoUno Int | |
| TipoDos Int | |
f (TipoUno x) = x | |
f (TipoDos x) = x | |
g t = case t of | |
TipoUno x -> x | |
TipoDos x -> x | |
h t = let (TipoUno x) = t | |
in x | |
caf = TipoUno 7 | |
main = do print (f caf) | |
print (g caf) | |
print (h caf) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment