summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/deriving/should_fail/drvfail-functor2.hs
blob: 7198755b805bf7980d46d0305da4dc63d951a221 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{-# LANGUAGE DeriveFunctor, DatatypeContexts #-}
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)

-- Derive Functor on a type with extra stupid-contraints on 'a'

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)