-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Generic indexing for many data structures -- -- This library provides generic indexing for a number of data -- structures, so that we can overload (!) in the same way we overload -- length with Foldable or (f)map with Functor. @package keyed @version 0.1.0.0 -- | This module provides functions for generic indexing of Monadic data -- structures. module Data.MKeyed -- | Data structures that allow monadic lookup of values. class MKeyed d where type family MKey d type family MValue d type family MContainer d :: * -> * indexM :: MKeyed d => d -> MKey d -> MContainer d (MValue d) lookupM :: MKeyed d => d -> MKey d -> MContainer d (Maybe (MValue d)) -- | An inline version of indexM. (!!) :: MKeyed d => d -> MKey d -> MContainer d (MValue d) -- | An inline version of lookupM. (!!?) :: MKeyed d => d -> MKey d -> MContainer d (Maybe (MValue d)) instance Data.MKeyed.MKeyed (Data.Vector.Mutable.STVector s a) -- | This module provides functions for generic indexing of data -- structures. module Data.Keyed -- | Data structures that allow lookup of values. class Keyed d where type family Key d type family Value d -- | Raises an exception on invalid key. index :: Keyed d => d -> Key d -> Value d -- | Returns Nothing on invalid key. lookup :: Keyed d => d -> Key d -> Maybe (Value d) -- | An inline version of index. (!) :: Keyed d => d -> Key d -> Value d -- | An inline version of lookup. (!?) :: Keyed d => d -> Key d -> Maybe (Value d) instance Data.Keyed.Keyed (Data.Sequence.Seq a) instance Data.Keyed.Keyed [a] instance GHC.Classes.Ord k => Data.Keyed.Keyed (Data.Map.Base.Map k v) instance Data.Keyed.Keyed (Data.Vector.Vector a) instance Data.Primitive.Types.Prim a => Data.Keyed.Keyed (Data.Vector.Primitive.Vector a) instance Foreign.Storable.Storable a => Data.Keyed.Keyed (Data.Vector.Storable.Vector a) instance Data.Vector.Unboxed.Base.Unbox a => Data.Keyed.Keyed (Data.Vector.Unboxed.Base.Vector a)