typerep-map-0.3.1: Efficient implementation of a dependent map with types as keys

Safe HaskellNone
LanguageHaskell2010

Data.TypeRep.OptimalVector

Contents

Synopsis

Map type

data TypeRepMap (f :: k -> Type) Source #

Instances
NFData (TypeRepMap f) Source # 
Instance details

Defined in Data.TypeRep.OptimalVector

Methods

rnf :: TypeRepMap f -> () #

empty :: TypeRepMap f Source #

Empty structure.

insert :: forall a f. Typeable a => 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

data TF f where Source #

Constructors

TF :: Typeable a => f a -> TF f 

fromList :: forall f. [TF f] -> TypeRepMap f Source #