Re: Class constraints for associated type synonyms

2011-04-01 Thread Jan-Willem Maessen
On Thu, Mar 24, 2011 at 11:36 AM, Simon Peyton-Jones simo...@microsoft.com wrote: | class Monoid (GeneratorOf a) = Generable a where |   type GeneratorOf a :: * - * |   construct :: GeneratorOf a - a | | Now, it seems I need FlexibleInstances to do this when I'm using an | associated type

RE: Class constraints for associated type synonyms

2011-03-24 Thread Simon Peyton-Jones
| class Monoid (GeneratorOf a) = Generable a where | type GeneratorOf a :: * - * | construct :: GeneratorOf a - a | | Now, it seems I need FlexibleInstances to do this when I'm using an | associated type synonym, but I don't need the flexibility when using a | multiparameter type class.

Class constraints for associated type synonyms

2011-03-23 Thread Jan-Willem Maessen
Hi all - I've been trying to construct a class declaration with an associated type synonym, but I'd like to constrain that type to belong to a particular class. Consider the following class: class Monoid m = Constructs c m | c - m where construct :: m - c This captures the idea that the