
On Sun, Apr 14, 2013 at 9:28 AM, Chris Wong
On Sun, Apr 14, 2013 at 5:10 PM, Christopher Howard
wrote: type Adjustment a = SaleVariables -> a
[...]
instance Monad Adjustment where
(>>=) = ... return = ...
Essentially, you can't partially apply type synonyms. I don't recall the exact reasoning, but if this sort of thing was allowed it would probably poke funny holes in the type system.
Also, Control.Monad.Instances already supplies a Monad instance for functions (r -> a). So even if that did pass, you'd bump into overlapping instances anyway.
The fact that that instance exists shows that you can define an instance like this (even though you don't have to, since it already exists). The trick is to define the type synonym partially applied. When you do that, you can define the instance: type Adjustment = (->) SaleVariables instance Monad Adjustment where Note that this needs the extensions TypeSynonymInstances and FlexibleInstances. Erik.