Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype TypeMap x = TypeMap (Map TypeRep Any)
- type family Item x t
- data OfType a
- null :: TypeMap x -> Bool
- size :: TypeMap x -> Int
- empty :: TypeMap x
- insert :: forall t x proxy. Typeable t => proxy t -> Item x t -> TypeMap x -> TypeMap x
- (<:) :: forall t x proxy. Typeable t => TypeMap x -> (proxy t, Item x t) -> TypeMap x
- update :: forall t x proxy. Typeable t => proxy t -> (Item x t -> Maybe (Item x t)) -> TypeMap x -> TypeMap x
- alter :: forall t x proxy. Typeable t => proxy t -> (Maybe (Item x t) -> Maybe (Item x t)) -> TypeMap x -> TypeMap x
- lookup :: forall t x proxy. Typeable t => proxy t -> TypeMap x -> Maybe (Item x t)
- delete :: forall t x proxy. Typeable t => proxy t -> TypeMap x -> TypeMap x
- union :: forall x. TypeMap x -> TypeMap x -> TypeMap x
- difference :: forall x. TypeMap x -> TypeMap x -> TypeMap x
- intersection :: forall x y. TypeMap x -> TypeMap y -> TypeMap x
- map :: forall x y. (forall t. Typeable t => Proxy t -> Item x t -> Item y t) -> TypeMap x -> TypeMap y
- toList :: forall r. TypeMap (OfType r) -> [r]
- toListMap :: forall tm r. (forall t. Proxy t -> Item tm t -> r) -> TypeMap tm -> [r]
- 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)
- type family Typed x t
- type family UnTyped x
- data ItemFun x y
- data ItemKleisli (f :: * -> *) x y
- withTypeRep :: forall x proxy. (forall t. Typeable t => Proxy t -> Typed x t) -> proxy x -> TypeRep -> UnTyped x
Exposed functions
Map from types t
of kind *
to values of type Item x t
.
An extensible type family mapping types (as keys) to types of values,
parameterized by types x
.
A constant mapping to type a
.
is the type of
maps from types to values of type TypeMap
(OfType
a)a
.
Instances
type UnTyped (OfType a) Source # | |
Defined in Data.TypeMap.Internal.Dynamic | |
type Typed (OfType a) t Source # | |
Defined in Data.TypeMap.Internal.Dynamic | |
type Item (OfType a) t Source # | |
Defined in Data.TypeMap.Internal.Dynamic |
insert :: forall t x proxy. Typeable t => proxy t -> Item x t -> TypeMap x -> TypeMap x Source #
Insert an element indexed by type t
.
update :: forall t x proxy. Typeable t => proxy t -> (Item x t -> Maybe (Item x t)) -> TypeMap x -> TypeMap x Source #
Update an element indexed by type t
.
alter :: forall t x proxy. Typeable t => proxy t -> (Maybe (Item x t) -> Maybe (Item x t)) -> TypeMap x -> TypeMap x Source #
Update a (possibly absent) 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
.
delete :: forall t x proxy. Typeable t => proxy t -> TypeMap x -> TypeMap x Source #
Delete a key and its value from the map. Does nothing if the key does not exist.
union :: forall x. TypeMap x -> TypeMap x -> TypeMap x Source #
Left-biased union of two maps; it keeps the first key if duplicates are found.
difference :: forall x. TypeMap x -> TypeMap x -> TypeMap x Source #
Difference of two maps; keep elements of the first map which are not in the second.
intersection :: forall x y. TypeMap x -> TypeMap y -> TypeMap x Source #
Intersection of two maps; keep elements of the first map which are also in the second.
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.
toList :: forall r. TypeMap (OfType r) -> [r] Source #
Reduce a constant type map into a plain list of values.
toListMap :: forall tm r. (forall t. Proxy t -> Item tm t -> r) -> TypeMap tm -> [r] Source #
Collapse a type map into a plain list of values.
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 type map. (map
with effects.)
Unsafe internals
type family Typed x t Source #
Instances
type Typed (OfType a) t Source # | |
Defined in Data.TypeMap.Internal.Dynamic | |
type Typed (ItemFun x y) t Source # | |
Defined in Data.TypeMap.Internal.Dynamic | |
type Typed (ItemKleisli f x y) t Source # | |
Defined in Data.TypeMap.Internal.Dynamic |
type family UnTyped x Source #
Instances
type UnTyped (OfType a) Source # | |
Defined in Data.TypeMap.Internal.Dynamic | |
type UnTyped (ItemFun x y) Source # | |
type UnTyped (ItemKleisli f x y) Source # | |
Defined in Data.TypeMap.Internal.Dynamic |
data ItemKleisli (f :: * -> *) x y Source #
Instances
type UnTyped (ItemKleisli f x y) Source # | |
Defined in Data.TypeMap.Internal.Dynamic | |
type Typed (ItemKleisli f x y) t Source # | |
Defined in Data.TypeMap.Internal.Dynamic |