Skip to content

Instantly share code, notes, and snippets.

@joseanpg
Created February 6, 2015 12:32
Show Gist options
  • Save joseanpg/8cf9bb323d7a3c3f1bf3 to your computer and use it in GitHub Desktop.
Save joseanpg/8cf9bb323d7a3c3f1bf3 to your computer and use it in GitHub Desktop.
case everything
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