summaryrefslogtreecommitdiff
path: root/testsuite/tests/deriving/should_compile/T11732c.hs
blob: 55553045c09fc303e38aa6d9b2476ee69c41c62c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PolyKinds #-}
module T11732c where

import Data.Kind

class Cat k (cat :: k -> k -> *) where
  catId   :: cat a a
  catComp :: cat b c -> cat a b -> cat a c

instance Cat * (->) where
  catId   = id
  catComp = (.)

newtype Fun2 a b = Fun2 (a -> b) deriving (Cat *)

-- The ticket says this should work:
--   newtype Fun1 a b = Fun1 (a -> b) deriving (Cat k)
-- But that requires that the kind of (Cat k) to depend on k, where k is local
-- This is all due for an update, anyway, when #14331 is done, and it's unclear
-- what the correct behavior here is, anyway. (Richard thinks: reject!)