[Haskell-beginners] How to call constructor from Template Haskell
aquagnu at gmail.com
Mon Dec 11 11:04:33 UTC 2017
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
More information about the Beginners