T1470.hs 621 Bytes
Newer Older
simonpj's avatar
simonpj committed
1
2
{-# LANGUAGE MultiParamTypeClasses, FlexibleContexts, FlexibleInstances, OverlappingInstances, UndecidableInstances #-}

simonpj's avatar
simonpj committed
3
4
-- Trac #1470

simonpj's avatar
simonpj committed
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module Foo where

class Sat a
class Data ctx a
instance  Sat (ctx Char)             => Data ctx Char
instance (Sat (ctx [a]), Data ctx a) => Data ctx [a]

class Data FooD a => Foo a

data FooD a = FooD

instance Foo t => Sat (FooD t)

instance Data FooD a => Foo a
instance Foo a       => Foo [a]
simonpj's avatar
simonpj committed
20
21
22
23
24
25
  -- Have: Foo a, Data FooD a, Foo [a]
  --
  -- Want superclasses: (Data FooD [a])
  -- and hence: Sat (FooD [a]), Data FooD a
  -- and hence: Foo [a]

simonpj's avatar
simonpj committed
26
instance                Foo [Char]