Maybe String -> CoreExpr in a GHC plugin

Joachim Breitner mail at joachim-breitner.de
Tue Jan 16 16:08:48 UTC 2018


Hi,

in a GHC plugin, I want to synthesize simple data structures, and
insert them into the code. What is the most idiomatic way of writing a
function, say,

  foo :: Maybe String -> CoreExpr

or

  foo :: Maybe String -> CoreM CoreExpr

so that the resulting CoreExpr describes the input. Abstractly
speaking, I could imagine creating the Core AST by hand (but I’d have
to figure out how to resolve the names of the constructors), or somehow
invoking the renamer, type-checker and desugarer from within CoreM.

Surely someone else has solved this problem before. How did you do it?

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/20180116/4007653d/attachment.sig>


More information about the Glasgow-haskell-users mailing list