14 Aug
2015
14 Aug
'15
2:21 p.m.
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. --Will On Thu, Aug 13, 2015 at 11:13 PM, Nikita Karetnikov <nikita@karetnikov.org> wrote:
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.