Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. data List = Cons Int List | Nil
  2.  
  3. data ListF a = Cons Int a | Nil
  4.  
  5. type ThreeList = ListF (ListF (ListF Void)))
  6.  
  7. ListF ListFF == ListFF
  8.  
  9. data Fix f = Fix {unfix :: f (Fix x)}
  10. type ListFF = Fix ListF
  11.  
  12. type ListAlg a = ListF a -> a
  13.  
  14. cata :: ListAlg a -> ListFF -> a
  15. cata f = f . fmap (cata f) . unfix
  16.  
  17. cata :: ListAlg a -> ListFF -> a
  18. cata :: (Either () (Int, a) -> a) -> ListFF -> a
  19. cata :: (() -> a) -> ((Int, a) -> a) -> ListFF -> a
  20. cata :: a -> (Int -> a -> a) -> ListFF -> a
  21. cata :: (Int -> a -> a) -> a -> [Int] -> a
  22.  
  23. cata :: (f a -> a) -> Fix f -> a
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement