[Haskell-cafe] Fwd: [Haskell-beginners] Monad instances and type synonyms
chrisyco+haskell-cafe at gmail.com
Sun Apr 14 09:28:58 CEST 2013
On Sun, Apr 14, 2013 at 5:10 PM, Christopher Howard
<christopher.howard at frigidcode.com> 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.
> If I try this, I get
> Type synonym `Adjustment' should have 1 argument, but has been given none
> In the instance declaration for `Monad Adjustment'
> But if I give an argument, then it doesn't compile either (it becomes a
> "*" kind). And I didn't want to make the type with a regular "data"
> declaration either, because then I have to give it a constructor, which
> doesn't fit with what I want the type to do.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
Chris Wong, fixpoint conjurer
e: lambda.fairy at gmail.com
More information about the Haskell-Cafe