Help needed: exporting pattern synonyms

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Help needed: exporting pattern synonyms

Dr. ERDI Gergo
Hi,

As you can see in http://ghc.haskell.org/trac/ghc/ticket/5144#comment:18,
my implementation of pattern synonyms is now feature complete for the
first two sections of
http://ghc.haskell.org/trac/ghc/wiki/PatternSynonyms, namely, simple
pattern synonyms and pattern-only synonyms. Bidirectional pattern synonyms
using 'where' will also be easy to add and will be part of my initial
submission. The current version of my code is at
https://github.com/gergoerdi/ghc/compare/pattern-synonyms

However, the one part I am struggling with is implementing exporting of
pattern synonyms. The pipeline is pretty clear to get the pattern synonym
definitions to the ModGuts, but I get lost there. Since they are a
completely compile-time thing, there's nothing to put in the CgGuts (well,
I guess the wrapper (i.e. the patsyn-in-an-expression-context) should be
put there). However, when I look at existing stuff in ModIface/ModDetails,
I don't really see a pattern for storing actual definitions there.

Could someone help me with this part please? Would it make sense to put
something like
https://raw.github.com/gergoerdi/ghc/pattern-synonyms/compiler/basicTypes/PatSyn.lhs 
in the interface? Or put the "psPatDef" and the "fmap snd psWrapper" parts
in the CgGuts and the rest in the interface?

Thanks,
  Gergo

--

   .--= ULLA! =-----------------.
    \     http://gergo.erdi.hu   \
     `---= gergo at erdi.hu =-------'