Copyright | (c) 2017-2020 Kowainik |
---|---|
License | MPL-2.0 |
Maintainer | Kowainik <xrom.xkov@gmail.com> |
Safe Haskell | None |
Language | Haskell2010 |
TypeRepMap implementation based on the optimal Vector.
Synopsis
- data TypeRepMap (f :: k -> Type) = TypeRepMap {}
- empty :: TypeRepMap f
- insert :: forall a f. a -> TypeRepMap f -> TypeRepMap f
- lookup :: forall a f. Typeable a => TypeRepMap f -> Maybe (f a)
- size :: TypeRepMap f -> Int
- data TF f where
- fromList :: forall f. [TF f] -> TypeRepMap f
Map type
data TypeRepMap (f :: k -> Type) Source #
Instances
NFData (TypeRepMap f) Source # | |
Defined in Data.TypeRep.OptimalVector rnf :: TypeRepMap f -> () # |
empty :: TypeRepMap f Source #
Empty structure.
insert :: forall a f. a -> TypeRepMap f -> TypeRepMap f Source #
Inserts the value with its type as a key.
lookup :: forall a f. Typeable a => TypeRepMap f -> Maybe (f a) Source #
Looks up the value at the type. >>> let x = lookup $ insert (11 :: Int) empty >>> x :: Maybe Int Just 11 >>> x :: Maybe () Nothing
size :: TypeRepMap f -> Int Source #
Returns the size of the TypeRepMap
.
Helpful testing functions
fromList :: forall f. [TF f] -> TypeRepMap f Source #