Advertisement
Guest User

Untitled

a guest
Dec 18th, 2018
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {-# LANGUAGE DeriveFunctor #-}
  2.  
  3. data F a = F a
  4.   deriving Functor
  5. data G a = G a
  6.   deriving Functor
  7.  
  8. counit :: F (G a) -> a
  9. counit (F (G a)) = a
  10.  
  11. unit :: a -> G (F a)
  12. unit a = G (F a)
  13.  
  14. {-
  15. *Main> :t unit
  16. unit :: a -> G (F a)
  17.  
  18. *Main> :t fmap counit
  19. fmap counit :: Functor f => f (F (G b)) -> f b
  20.  
  21. *Main> :t fmap counit . unit
  22. fmap counit . unit :: G b -> G b  -- WTF? Shouldn't the type be G (F (G b)) -> G b ?
  23. -}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement