type-map-0.1.0.0: Type-indexed maps

Safe HaskellNone
LanguageHaskell2010

Data.TypeMap.Dynamic

Synopsis

Documentation

data TypeMap x Source #

Map from types t of kind * to values of type Item x t.

type family Item x t Source #

An extensible type family mapping types (as keys) to types of values, parameterized by types x.

Instances

type Item (OfType a) t Source # 
type Item (OfType a) t = a

null :: TypeMap x -> Bool Source #

Whether the map is empty.

insert :: forall t x proxy. Typeable t => proxy t -> Item x t -> TypeMap x -> TypeMap x Source #

Insert an element indexed by type t.

lookup :: forall t x proxy. Typeable t => proxy t -> TypeMap x -> Maybe (Item x t) Source #

Lookup an element indexed by type t.

map :: forall x y. (forall t. Typeable t => Proxy t -> Item x t -> Item y t) -> TypeMap x -> TypeMap y Source #

Map a function on all elements.

traverse :: forall f x y. Applicative f => (forall t. Typeable t => Proxy t -> Item x t -> f (Item y t)) -> TypeMap x -> f (TypeMap y) Source #

Traverse the map.

data OfType a Source #

A constant mapping to type a. TypeMap (OfType a) is the type of maps from types to values of type a.

Instances

type UnTyped (OfType a) Source # 
type UnTyped (OfType a) = a
type Typed (OfType a) t Source # 
type Typed (OfType a) t = a
type Item (OfType a) t Source # 
type Item (OfType a) t = a