[Haskell] Quantified class constraints (& back-chaining)

Stefan O'Rear stefanor at cox.net
Wed Aug 1 20:57:32 EDT 2007

On Wed, Aug 01, 2007 at 05:29:19PM -0700, Conal Elliott wrote:
> Sadly, this solution runs into the problem of instance selection based only
> on head-matching, not back-chaining into constraints.  For instance, I'd
> like also to use the following "conflicting" declaration.
>     instance (Applicative f, Monoid a) => Monoid (f a) where
>       mempty  = pure mempty
>       mappend = liftA2 mappend

No quotes - [] is both Applicative and Monoid.  Should [String]
["ab","cd"] `mappend` ["ef","gh"] give ["ab","cd","ef","gh"] or

> What's the state of thinking & doing with regard to universally quantified
> class constraints?
> Note that hereditary Harrop formulas do include universally quantified
> goals.  Less ambitiously, I think GHC's type-checker already deals with
> universally-quantified variables, so perhaps quantified constraints are not
> a great reach (just guessing).

It's something I've wanted... Got a link for hereditary Harrop formulas
so I can add them to my to-implement-when-Qhc-is-good-enough list?
Google isn't telling me much about them except how to add support for
constaints, which isn't terribly helpful.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell/attachments/20070801/0410c559/attachment.bin

More information about the Haskell mailing list