Annotations with names

Joachim Breitner mail at
Sat Nov 4 15:33:01 UTC 2017


I’d like to use Annotations to transport some meta-information from the
Haskell source to GHC Plugins (as they are meant to be, right?).

But I am struggling expressing annotations that relate different
symbols. Here are some hypthetical examples what I want to express:

    foo :: String -> String
    foo = …

    bar :: [(String,String), (String, String)]
    {-# ANN bar (TestCasesFor 'foo) #-}

    rec :: Natural -> (a -> a) -> a -> a
    {-# ANN rec (RecurserFor 'Natural) $-}

This code actually works (with TemplateHaskell). It will put a TH.Name
into the annotations, but when I am in Core, I need a core Name.

Is there a good way of transporting such references in Annotations so
that the desugarer (or the renamer) will do the necessary name changes
for me?

And slightly related: Do Annotations keep bindings alive? (It seems so,
but then it should be documented in


Joachim “nomeata” Breitner
  mail at
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the Glasgow-haskell-users mailing list