Guest User

Untitled

a guest
Oct 17th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. {-# LANGUAGE ConstraintKinds #-}
  2. {-# LANGUAGE KindSignatures #-}
  3. {-# LANGUAGE FunctionalDependencies #-}
  4.  
  5. module Playground4 where
  6.  
  7. import Data.Kind (Constraint)
  8. import qualified Data.List as List
  9.  
  10. class GFunctor (c :: * -> Constraint) (f :: * -> *) | f -> c where
  11. gfmap :: c b => (a -> b) -> (f a -> f b)
  12.  
  13. type EmptyConstraint a = ()
  14.  
  15. instance GFunctor EmptyConstraint [] where
  16. gfmap = List.map
  17.  
  18.  
  19. -- error:
  20. -- • Expected kind ‘* -> Constraint’,
  21. -- but ‘EmptyConstraint’ has kind ‘* -> *’
  22. -- • In the first argument of ‘GFunctor’, namely ‘EmptyConstraint’
  23. -- In the instance declaration for ‘GFunctor EmptyConstraint []’
Add Comment
Please, Sign In to add comment