[Haskell-cafe] Improving MPTC usability when fundeps aren't appropriate?

Bulat Ziganshin bulat.ziganshin at gmail.com
Wed Aug 5 12:56:36 EDT 2009


Hello Daniel,

Wednesday, August 5, 2009, 8:00:06 PM, you wrote:

> class Moo a b where
>   moo :: a -> a

> instances. Another solution would be to artificially force moo to take
> a "dummy" b so that the compiler can figure out which instance you
> meant. That's what I've been doing in the mean time, but wouldn't it
> be simpler and less hackish to add a some form of "instance
> annotation", like a type annotation, that would make it possible to
> specify what instance you wanted when it's ambiguous?

imho, no. you propose to add one more feature when existing features
can serve:

class Moo a b where
  moo :: a -> b -> a

f x = moo x (undefined::Int)

btw, may be associated types or associated type synonyms (these are
novel features superseding FDs) is what you need?



-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list