testsuite: Assert that testsuite ways are known
[ghc.git] / testsuite / tests / typecheck / should_compile / tc237.hs
1 {-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
2 {-# LANGUAGE RankNTypes, MultiParamTypeClasses, FunctionalDependencies #-}
3
4 -- This one caught a bug in the implementation of functional
5 -- dependencies, where improvement must happen when
6 -- checking the call in 'test4'
7
8 module ShouldCompile where
9
10 newtype M s a = M a
11
12 class Modular s a | s -> a
13
14 wim :: forall a w. Integral a
15 => a -> (forall s. Modular s a => M s w) -> w
16 wim i k = error "urk"
17
18 test4' :: (Modular s a, Integral a) => M s a
19 test4' = error "urk"
20
21 test4 = wim 4 test4'
22 -- Integral a0, (Modular s a0 => Modular s1 a1, Integral a1, M s1 a1 ~ M s w0)
23 -- Under the implication, [D] a1 ~ a0, [W] a1 ~ w0
24 -- Hence a1 := w0, [D] w0 ~ a0