summaryrefslogtreecommitdiff
path: root/testsuite/tests/deriving/should_compile/T14339.hs
blob: 098b6e829a01b4a3f4e36224523ba96ae95a9d32 (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
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE UndecidableInstances #-}
module Bug where

import GHC.TypeLits

newtype Foo = Foo Int

class Bar a where
  bar :: a

instance (TypeError (Text "Boo")) => Bar Foo where
  bar = undefined

newtype Baz = Baz Foo
  deriving Bar

-- Apparently we derive
--  instance TypeError (Text "Boo") => Bar Baz
--
-- Is that really what we want?  It defers the type
-- error... surely we should use standalone deriving
-- if that is what we want?
-- See GHC.Tc.Validity.validDerivPred and #22696.