summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/T13526.hs
blob: efe32bd9121b4d03067f5576f07c8e13d6c9dc54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{-# LANGUAGE FlexibleContexts, MultiParamTypeClasses, FlexibleInstances #-}

module T13526 where

class C a where
  op :: a -> a

instance {-# OVERLAPPING #-} C [Char] where
  op x = x

instance C a => C [a] where
  op (x:xs) = [op x]

instance C a => C (Maybe a) where
  op x = error "urk"

-- We should get no complaint
foo :: C [a] => a -> [a]
foo x = op [x]

bar :: C (Maybe a) => a -> Maybe a
bar x = op (Just x)