[Haskell-cafe] Substituting values

Radical radical at google.com
Fri Dec 21 18:46:25 CET 2012


Sometimes I'll need something like:

  if value == Foo then Bar else value

Or some syntactic variation thereof:

  case value of { Foo -> Bar; _ -> value }

Is there a better/shorter way to do it? I'm surprised that it's more
complicated to substitute a value on its own than e.g. in a list, using
filter. Or perhaps I'm missing the right abstraction?

Thanks,

Alvaro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121221/277976bf/attachment.htm>


More information about the Haskell-Cafe mailing list