Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. module Main where
  2.  
  3. data Letter a =
  4. A a
  5. | B a
  6. | C String
  7. deriving (Show)
  8.  
  9. -- getConstructor :: String -> (a -> Letter ?) -- <==
  10. getConstructor x
  11. | x == "a" = A
  12. | x == "b" = B
  13. | otherwise = C
  14.  
  15.  
  16. main = print $ theType
  17. where theType = (getConstructor "b") "its b!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement