Send Beginners mailing list submissions to
        beginners@haskell.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  How to call constructor from Template Haskell (Baa)


----------------------------------------------------------------------

Message: 1
Date: Mon, 11 Dec 2017 13:04:33 +0200
From: Baa <aqua...@gmail.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: [Haskell-beginners] How to call constructor from Template
        Haskell
Message-ID: <20171211130433.6e191c18@Pavel>
Content-Type: text/plain; charset=US-ASCII

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


------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 114, Issue 13
******************************************

Reply via email to