Created
October 17, 2018 17:20
-
-
Save dcastro/1d58617f2a87c83aeb4881b0de6a89f5 to your computer and use it in GitHub Desktop.
Alias for empty constraint `* -> Constraint`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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 []’ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment