summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/T5676.hs
blob: 9fa8404b0be3c8860de8f318e0787fbd3cc4e4a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{-# LANGUAGE ScopedTypeVariables, InstanceSigs #-}
module Foo where

data T a = T a

class C a where
  foo :: b -> a -> (a, [b])

instance C a => C (T a) where
  foo :: forall b. b -> T a -> (T a, [b])
  foo x (T y) = (T y, xs)
     where
       xs :: [b]
       xs = [x,x,x]

instance Functor T where
  fmap :: (a -> b) -> T a -> T b
  fmap f (T x) = T (f x)