Lots of error message wibbling, following the
[ghc.git] / testsuite / tests / indexed-types / should_fail / T4272.hs
1 {-# LANGUAGE TypeFamilies, ScopedTypeVariables, FlexibleContexts #-}
2 module T4272 where
3
4 class Family f where
5 terms :: f a -> a
6
7 class Family (TermFamily a) => TermLike a where
8 type TermFamily a :: * -> *
9
10 laws :: forall a b. TermLike a => TermFamily a a -> b
11 laws t = prune t (terms (undefined :: TermFamily a a))
12
13 prune :: TermLike x => TermFamily x x -> TermFamily x x -> b
14 prune = undefined
15
16 -- terms :: Family f => f a -> a
17 -- Instantiate with f = TermFamily a
18 -- terms :: Family (TermFamily a) => TermFamily a a -> a
19 -- (terms (undefined::TermFamily a a) :: Family (TermFamily a) => a
20 -- So the call to prune forces the equality
21 -- TermFamily a a ~ a
22 -- which triggers an occurs check