[Haskell-cafe] Updating the Haskell Standard

ajb at spamcop.net ajb at spamcop.net
Thu Jul 21 19:59:15 EDT 2005


G'day all.

Quoting Brian Smith <brianlsmith at gmail.com>:

> Even if "undecidable instances" was standardized, would we want it
> turned on by default? I am trying to write "real" programs in Haskell
> and I have never even comtemplated using undecidable instances.

There's only one situation where I've found it necessary, and I think
it's due to a missing feature in Haskell.

Sometimes when I'm doing generic programming, I need a function to have
some group of typeclass constraints:

    foo :: (MonadIO m, Ord k, Foo k v) => k -> m v

And sometimes these constraints appear in more than one function.  For
brevity, I want a "typeclass synonym".  The only way I've found to do
this is:

    class (Monad m, Ord k, Foo k v) => MyCtx m k v
    instance (Monad m, Ord k, Foo k v) => MyCtx m k v

which now requires undecidable instances.

Cheers,
Andrew Bromage


More information about the Haskell-Cafe mailing list