Hacker News new | ask | show | jobs
by Tarean 2760 days ago
It's also useful for stuff like 'get' to look differently.

    user ^. id
    txt ^? _JSON . key "foo"
    txt ^?! _JSON . key "foo"
First one gives exactly one result. The second one is the equivalent of returning null on failure. The third one throws an exception on failure.

And because of the somewhat peculiar implementation of van laarhoven lenses we get subtyping so it doesn't get in the way.