[Haskell-cafe] Substituting values

Radical radical at google.com
Tue Dec 25 02:43:33 CET 2012


On Sat, Dec 22, 2012 at 12:35 AM, Kim-Ee Yeoh <ky3 at atamo.com> wrote:

> This is reminiscent of the Either (exception) monad where Left values, the
> exceptions, pass through unaltered, and Right values are transformable,
> i.e. acted on by functions.
>
>
Interesting. I hadn't thought of that parallel. But yes, I think it's a
similar notion of: transform the value only in one (or more) cases. It's
also similar to the Maybe monad in that I'm looking for something akin to
fromMaybe, but without having to place the value in a Maybe.


> But I have no idea what you're trying to achieve in the bigger picture.
> Help us help you by fleshing out your use case.
>
>
I'm not sure the bigger picture is helpful, but, for example, the last case
was something like:

  if ch == '\n' then ' ' else ch

I think I ended up rewriting it as something like:

  replace '\n' = ' '
  replace ch = ch

Which is straightforward enough, though it feels to me like there's too
much syntax involved.

Thanks,

Alvaro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121224/974cf36b/attachment.htm>


More information about the Haskell-Cafe mailing list