Where are the HsTyVarBndrs collapsed in an explicit HsForAllTy?

Alan & Kim Zimmerman alan.zimm at gmail.com
Thu Apr 9 08:30:23 UTC 2015


When parsing

    extremumNewton :: (Eq a, Fractional a) =>
                  (forall tag. forall tag1.
                          Tower tag1 (Tower tag a)
                              -> Tower tag1 (Tower tag a))
                      -> a -> [a]

the nested `forall` declarations are parsed by

    ctypedoc :: { LHsType RdrName }
            : 'forall' tv_bndrs '.' ctypedoc {% hintExplicitForall (getLoc
$1) >>
                                                ams (sLL $1 $> $
mkExplicitHsForAllTy $2

(noLoc []) $4)
                                                    [mj AnnForall $1,mj
AnnDot $3] }

This generates a HsForAllTy for the first forall that simply wraps the
second one, which is also a `ctypedoc`.

But, when looking at the AST provided via ParsedSource, the two `forall`s
are collapsed into a single one, containing both `tag` and `tag1` in the
TyVarBndrs.

In the process the annotation for the second forall loses its anchor, as
that span is no longer in the AST.

I cannot find where this collapsing takes place, can  anyone point me at it?

Thanks
  Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20150409/828a830c/attachment.html>


More information about the ghc-devs mailing list