summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail/T11948.hs
blob: 13ecce5d8e110299c27ccb5c59153062d5367014 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{-# LANGUAGE MultiParamTypeClasses, TypeFamilies, NoMonoLocalBinds #-}
-- The NoMonoLocalBinds is crucial to making inference fail
-- See #11948 comment:2
{-# LANGUAGE FlexibleContexts, ScopedTypeVariables #-}

module T11948 where

type family F b

newtype Foo r = Foo r

type instance F (Foo r) = Foo (F r)

class Bar a b where
  bar :: a -> b

instance (Bar a b) => Bar (Foo a) (Foo b)

bug :: forall zq. (Bar (Foo (F zq)) (Foo zq))
               => Foo (F zq) -> Foo zq
bug sk = let x = bar sk :: Foo zq
         in x