1 {-# LANGUAGE TypeFamilies, FunctionalDependencies, FlexibleContexts, GADTs, ScopedTypeVariables #-}

21 f x =

30 {- This example comes from Note [Extra TcS Untouchables] in TcSimplify. It demonstrates

31 why when floating equalities out of an implication constraint we must record the free

32 variables of the equalities as untouchables. With GHC 7.4.1 this program gives a Core

33 Lint error because of an existential escaping.

35 assuming x:beta

37 forall b. F Int ~ [beta] (from g1)

38 forall a. F Int ~ [[alpha]], C beta [a] (from g2)

40 -}

45 {- Assume x:beta

46 From g1 we get [W] (forall b. F Int ~ [beta])

48 From g2 we get [W] (forall c. 0 => F Int ~ [[alpha]] /\ C beta [c])

49 (g2 is not generalised; the forall comes from the TEx pattern)

51 approximateWC then gives the candidate constraints to quantify

52 F Int ~ [beta], F Int ~ [[alpha']]

54 (alpha' is the promoted version of alpha)

56 Now decide inferred sig for f :: F Int ~ [beta] => beta -> blah

57 since beta is mentioned in tau-type for f but alpha' is not

59 Perhaps this is a stupid constraint to generalise over (we don't

60 generalise over (C Int).

61 -}