summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/T7875.hs
blob: 7ea0520133180669132d3a20c14f264c3fc8d0f0 (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
27
28
29
30
31
32
33
34
35
36
{-# OPTIONS_GHC -Wno-redundant-constraints -Wno-simplifiable-class-constraints #-}
{-# LANGUAGE
     FlexibleContexts
   , FlexibleInstances
   , FunctionalDependencies
   , MultiParamTypeClasses
   , KindSignatures
   , UndecidableInstances #-}

module T7875 where

import Data.Kind (Type)

class Het a b | a -> b where
  het :: m (f c) -> a -> m b

class GHet (a :: Type -> Type) (b :: Type -> Type) | a -> b
instance            GHet (K a) (K [a])
instance Het a b => GHet (K a) (K b)


data A a   = A (A a)
data K x a = K x

instance Het (A a) (A [a]) where het = het1

het1 :: (GHet (K a) (K b)) => m (f c) -> a -> m b
-- Weird test case: (GHet (K a) (K b)) is simplifiable
het1 = undefined


{- Wanted
     (GHet (K (A a)) (K (A [a])))

-- Fundeps give ([A a] ~ A [a])
-}