drvfail-functor2.hs 668 Bytes
Newer Older
1
{-# LANGUAGE DeriveFunctor, DatatypeContexts #-}
twanvl's avatar
twanvl committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
module ShouldFail where

-- Derive Functor on a type that uses 'a' in the wrong places

newtype InFunctionArgument a = InFunctionArgument (a -> Int)
   deriving (Functor)

newtype OnSecondArg a = OnSecondArg (Either a a)
   deriving (Functor)

-- Derive Functor on a type with no arguments

newtype NoArguments = NoArguments Int
   deriving (Functor)

17
-- Derive Functor on a type with extra stupid-constraints on 'a'
twanvl's avatar
twanvl committed
18 19 20 21 22 23 24 25 26

data Eq a => StupidConstraint a = StupidType a
   deriving (Functor)

-- A missing Functor instance

data NoFunctor a = NoFunctor
data UseNoFunctor a = UseNoFunctor (NoFunctor a)
   deriving (Functor)