[Haskell-cafe] The (!) operation

Christopher Done chrisdone at googlemail.com
Thu Mar 8 17:19:01 CET 2012


‘Ello.

Is there a generalization of this operator? It's all over the place,
it's basically

    (!) :: (Monad m, Indexed collection index value) => index ->
container -> m value

We have `(!!)` on lists, `(!)` on maps, vectors, json objects, …
(doesn't seem there's one for bytestring)

(Though I seem to recall the monadic return value being frowned upon
but I don't recall why.)

Thoughts?

Ciao!



More information about the Haskell-Cafe mailing list