[Haskell-cafe] Re: Different choice operations in a continuation monad

Sebastian Fischer sebf at informatik.uni-kiel.de
Tue Jun 22 06:32:48 EDT 2010


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.)





More information about the Haskell-Cafe mailing list