Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {-# LANGUAGE ConstraintKinds #-}
- {-# LANGUAGE KindSignatures #-}
- {-# LANGUAGE FunctionalDependencies #-}
- module Playground4 where
- import Data.Kind (Constraint)
- import qualified Data.List as List
- class GFunctor (c :: * -> Constraint) (f :: * -> *) | f -> c where
- gfmap :: c b => (a -> b) -> (f a -> f b)
- type EmptyConstraint a = ()
- instance GFunctor EmptyConstraint [] where
- gfmap = List.map
- -- error:
- -- • Expected kind ‘* -> Constraint’,
- -- but ‘EmptyConstraint’ has kind ‘* -> *’
- -- • In the first argument of ‘GFunctor’, namely ‘EmptyConstraint’
- -- In the instance declaration for ‘GFunctor EmptyConstraint []’
Add Comment
Please, Sign In to add comment