Heinrich Apfelmus wrote:
Sebastian Fischer wrote:
I still don't understand why it is impossible to provide `orElse` with
the original type. I will think more about the reason you gave.

The reason is that you have chosen the "wrong" type for your
continuation monad; it should be

 newtype CMaybe a = CMaybe (forall r. (a -> Maybe r) -> Maybe r)

Yes, with this type `orElse` has the same type as `mplus`, which is very nice.

<Aside>

Personally, I recommend to stop thinking about continuations altogether
and instead use the approach I've outlined in "The Operational Monad
Tutorial"

I appreciate your operational monad tutorial both for the idea and how you explained it. But the advice "stop thinking about X because Y is better" feels odd to me. Before I know by myself that Y is better than X (which requires thinking about both X and Y) I don't feel comfortable following such advice. Afterwards, I don't need such advice ;)

There may be more to X than just Y. IIRC, there is more to 'continuations' than 'monads'. For example, the implementation of `callCC` does not type check with your changed data type.

</Aside>

I shall try to implement a monad that supports two choice operations (one which fulfills the distributive law and one which satisfies the cancellation property) with the operational package.

Cheers,
Sebastian


--
Underestimating the novelty of the future is a time-honored tradition.
(D.G.)



_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to