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

Safe HaskellNone
LanguageHaskell2010

Data.TypeRep.CMap

Synopsis

Documentation

newtype TypeRepMap (f :: k -> *) #

Map-like data structure with types served as the keys.

Constructors

TypeRepMap 

Fields

  • unMap :: Map TypeRep Any
     
Instances
NFData (TypeRepMap f) # 
Instance details

Defined in Data.TypeRep.CMap

Methods

rnf :: TypeRepMap f -> ()

empty :: TypeRepMap f #

Empty structure.

insert :: forall a f. Typeable a => f a -> TypeRepMap f -> TypeRepMap f #

Inserts the value with its type as a key.

keys :: TypeRepMap f -> [TypeRep] #

lookup :: forall a f. Typeable a => TypeRepMap f -> Maybe (f a) #

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 #