
On Sat, Dec 22, 2012 at 12:35 AM, Kim-Ee Yeoh
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