How to call constructor from Template Haskell

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

How to call constructor from Template Haskell

PY
Hello All!

I have function which constructs some data type. It has signature `Name -> Q [Dec]`.
Somewhere in its body I'm extracting constructors of some type with pattern-matching:

  case tyCons of
    DataD ctx nm tyVars mbKind cs derivs -> ...
 
 Type of those constructors `cs` instantiates some class like this:
 
   class MyClass a where
     specialValue :: a
     
 So, I'm iterating over those `cs` but I want to skip one of them which is
 equal to `specialValue`. Something like this:
 
   [c | c <- cs, c /= specialValue]
 
 How to do this with Template Haskell's `Con` type (`c`::Con) - I can't call
 it to compare created value with a `specialValue` ?
 
 ===
 Best regards, Paul
_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners