Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module Count where
  2.  
  3. test :: [Int]
  4. test = [count, count 1 2 3, count "" [True,False] id (+)]
  5.  
  6. count :: Count t => t
  7. count = count' undefined
  8.  
  9. class Count t where
  10.    count' :: a -> t
  11.  
  12. instance Count Int where
  13.     count' = const 0
  14.  
  15. instance Count r => Count (a -> r) where
  16.    count' x = const count' x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement