Personal tools

Talk:Comparing class alias proposals

From HaskellWiki

Jump to: navigation, search

About context synonyms:

A context synonym may appear anywhere a context is allowed:
Q: May a CS's RHS refer to other CS's? For example:
context Foo a = (BoundedEnum a, Eq a, Ord a)

I think you've already answered your own question. What to do about loops is something else of course.

Q: Apart from type constructors, may a CS's variables be class constructors (things of kind ... -> Context) as well? For example:
Q: May CS's be passed as arguments to other CS's? For example

I'd say this is an obvious no until we have some more general concept of class-variables. And let's not try to fit that in a context-synonym-proposal ;)

Q: May CS's be partially applied? Consider these alternate definitions of BoundedEnum:

Does this actually buy us anything? Unless we go for one of the extensions and we want something like this to be the only syntax perhaps?

On Class alias or context synonym:

Class aliases (in the case of writing instances of them) seem like a strict subset of context synonyms.

I guess you mean "together with the extension of multi-instance declarations"? And this is only as long as we haven't added (default)methods to the class-alias declaration, isn't it?