
David Menendez wrote:
Brian Hulley writes:
Also, as a second point, could functional dependencies in type classes be written using a similar syntax eg instead of
class Insert t c a | c a -> t where insert :: t -> c a -> c a
we could write:
class Insert (h (c a)) c a where insert :: h (c a) -> c a -> c a <snip> Your example, in the syntax of associated type synonyms, would look something like this:
class Insert c a where type T c a insert :: T c a -> c a -> c a
Thanks for the link. I suppose h(c a) can't be used on its own because h is assumed to be a tycon rather than a general type function, but if this restriction were lifted, the syntax "h a" meaning "some type determined by a by the type function h" could be used both for intersection typing and multi-param type classes. Regards, Brian.