Annotations with names

Joachim Breitner mail at joachim-breitner.de
Sat Nov 4 15:33:01 UTC 2017


Hi,

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
https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/extending_ghc.html#source-annotations


Thanks,
Joachim


-- 
Joachim “nomeata” Breitner
  mail at joachim-breitner.de
  https://www.joachim-breitner.de/
-------------- 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: <http://mail.haskell.org/pipermail/glasgow-haskell-users/attachments/20171104/96532078/attachment.sig>


More information about the Glasgow-haskell-users mailing list