[Haskell-cafe] The (!) operation

Francesco Mazzoli f at mazzo.li
Thu Mar 8 19:12:37 CET 2012

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

The type signature that you wrote is very generic and doesn't help in 
introducing effects while retrieving the indexed value, which I imagine 
is what you wanted to do.

I guess you could define a type family for the monad type as well, e.g.:

type family Index f
type family IndexMonad f :: * -> *

class Functor f => Indexed f where
     index :: Index f -> f a -> (IndexMonad f) (Maybe a)


More information about the Haskell-Cafe mailing list