On Jun 19, 2010, at 1:48 PM, Heinrich Apfelmus wrote:

In my code,  mzero  is indeed an identity for  orElse [...]
The observation is any action can be brought into one of the forms

  mzero
  return a `mplus` return b `mplus` ...

which corresponds to the list type  [a] .

Ok that makes sense because the list types supports both a cancelling `orElse` and a distributive `mplus` with identity `mzero`.

[...] you can implement your type as

  newtype CMaybe a = CMaybe { forall b . (a -> [b]) -> [b] }

Yes. For me it was interesting to see how far we get by wrapping `Maybe` in `Codensity`: we get more than `Maybe` but not as much as `[]`.

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