[Haskell-cafe] Substituting values
Chaddaï Fouché
chaddai.fouche at gmail.com
Wed Dec 26 19:14:46 CET 2012
Since recently, the notion of prisms from the lens library can achieve
that : to modify a value only in certain conditions but you have to
write the prism so it's not that convenient, though at least you'll
have an uniform API.
See http://hackage.haskell.org/packages/archive/lens/3.7.0.2/doc/html/Control-Lens-Prism.html
, especially the "nat" example.
--
Jedaï
On Fri, Dec 21, 2012 at 6:46 PM, Radical <radical at google.com> wrote:
> 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
>
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
More information about the Haskell-Cafe
mailing list