[Haskell-cafe] Library for overloaded indexing (a la (!))
will.yager at gmail.com
Fri Aug 14 06:21:39 UTC 2015
That's completely different behavior than indexing, and introduces even
more syntactic noise if you just want to index.
If I mis-index a vector, I don't want it to fail silently with mempty; I
want it to fail loudly. What you've described (default value on
out-of-bounds access) is not correct for most use cases. Sometimes
exceptions are the right behavior.
On Thu, Aug 13, 2015 at 11:13 PM, Nikita Karetnikov <nikita at karetnikov.org>
> > getSum $ [1,2,3,4] ^. ix 42
> > => 0
> Oh, one more thing: this is a bit different from ! or !! (in a good way)
> because it doesn't raise an exception.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe