fcf-containers-0.5.0: Data structures and algorithms for first-class-families

Copyright(c) gspia 2020-
LicenseBSD
Maintainergspia
Safe HaskellSafe
LanguageHaskell2010

Fcf.Data.NatMap

Contents

Description

Fcf.Data.NatMap

NatMap provides an interface to mapping keys (Nat's) to values, which is similar to IntMap given by the containers-package. Note that the this module still misses some of the methods that can be found in containers. If you need some, please do open up an issue or better, make a PR.

Many of the examples are from containers-package.

Synopsis

NatMap type

data NatMap v Source #

A type corresponding to IntMap in the containers.

The representation is based on type-level lists. Please, do not use that fact but rather use the exposed API. (We hope to change the internal data type to balanced tree similar to the one used in containers. See TODO.md.)

Constructors

NatMap [(Nat, v)] 
Instances
type Eval (Empty :: NatMap v -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Empty :: NatMap v -> Type) = NatMap ([] :: [(Nat, v)])
type Eval (FromList lst :: NatMap v -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (FromList lst :: NatMap v -> Type) = NatMap lst
type Eval (Singleton k v2 :: NatMap v1 -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Singleton k v2 :: NatMap v1 -> Type) = NatMap ((,) k v2 ': ([] :: [(Nat, v1)]))
type Eval (Delete k (NatMap lst) :: NatMap v -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Delete k (NatMap lst) :: NatMap v -> Type) = NatMap (Eval (Filter (Not <=< ((TyEq k :: Nat -> Bool -> Type) <=< (Fst :: (Nat, v) -> Nat -> Type))) lst))
type Eval (Union (NatMap lst1) (NatMap lst2) :: NatMap v -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Union (NatMap lst1) (NatMap lst2) :: NatMap v -> Type)
type Eval (Filter f (NatMap lst) :: NatMap v -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Filter f (NatMap lst) :: NatMap v -> Type) = NatMap (Eval (Filter (f <=< (Snd :: (Nat, v) -> v -> Type)) lst))
type Eval (FilterWithKey f (NatMap lst) :: NatMap v -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (FilterWithKey f (NatMap lst) :: NatMap v -> Type) = NatMap (Eval (Filter (Uncurry f) lst))
type Eval (Intersection mp1 mp2 :: NatMap v -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Intersection mp1 mp2 :: NatMap v -> Type)
type Eval (Difference mp1 mp2 :: NatMap v -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Difference mp1 mp2 :: NatMap v -> Type)
type Eval (Insert k v2 (NatMap lst) :: NatMap v1 -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Insert k v2 (NatMap lst) :: NatMap v1 -> Type) = If (Eval (Elem k =<< Map (Fst :: (Nat, v1) -> Nat -> Type) lst)) (NatMap lst) (NatMap ((,) k v2 ': lst))
type Eval (Adjust f k (NatMap lst) :: NatMap v -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Adjust f k (NatMap lst) :: NatMap v -> Type)
type Eval (NatMapWithKey f mp :: NatMap v2 -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (NatMapWithKey f mp :: NatMap v2 -> Type)
type Eval (Map f mp :: NatMap v2 -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Map f mp :: NatMap v2 -> Type) = NatMap (Eval ((Map (Second f :: (Nat, v1) -> (Nat, v2) -> Type) :: [(Nat, v1)] -> [(Nat, v2)] -> Type) =<< Assocs mp))
type Eval (InsertWith f k v2 (NatMap lst) :: NatMap v1 -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (InsertWith f k v2 (NatMap lst) :: NatMap v1 -> Type)
type Eval (Partition f (NatMap lst) :: (NatMap v, NatMap v) -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Partition f (NatMap lst) :: (NatMap v, NatMap v) -> Type)

Query

data Null :: NatMap v -> Exp Bool Source #

Null

Example

Expand
>>> :kind! Eval (Null =<< FromList '[ '(5,"a"), '(3,"b")])
Eval (Null =<< FromList '[ '(5,"a"), '(3,"b")]) :: Bool
= 'False
>>> :kind! Eval (Null =<< Empty)
Eval (Null =<< Empty) :: Bool
= 'True
Instances
type Eval (Null (NatMap (_1 ': _2)) :: Bool -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Null (NatMap (_1 ': _2)) :: Bool -> Type) = False
type Eval (Null (NatMap ([] :: [(Nat, v)])) :: Bool -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Null (NatMap ([] :: [(Nat, v)])) :: Bool -> Type) = True

data Size :: NatMap v -> Exp Nat Source #

Size

Example

Expand
>>> :kind! Eval (Size =<< FromList '[ '(5,"a"), '(3,"b")])
Eval (Size =<< FromList '[ '(5,"a"), '(3,"b")]) :: Nat
= 2
Instances
type Eval (Size (NatMap lst) :: Nat -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Size (NatMap lst) :: Nat -> Type) = Eval (Length lst)

data Lookup :: Nat -> NatMap v -> Exp (Maybe v) Source #

Lookup

Example

Expand
>>> :kind! Eval (Lookup 5 =<< FromList '[ '(5,"a"), '(3,"b")])
Eval (Lookup 5 =<< FromList '[ '(5,"a"), '(3,"b")]) :: Maybe Symbol
= 'Just "a"
>>> :kind! Eval (Lookup 7 =<< FromList '[ '(5,"a"), '(3,"b")])
Eval (Lookup 7 =<< FromList '[ '(5,"a"), '(3,"b")]) :: Maybe Symbol
= 'Nothing
Instances
type Eval (Lookup k (NatMap ((,) k1 v2 ': rst)) :: Maybe v1 -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Lookup k (NatMap ((,) k1 v2 ': rst)) :: Maybe v1 -> Type) = Eval (If (Eval (TyEq k k1)) (Pure (Just v2)) (Lookup k (NatMap rst)))
type Eval (Lookup k (NatMap ([] :: [(Nat, v)])) :: Maybe v -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Lookup k (NatMap ([] :: [(Nat, v)])) :: Maybe v -> Type) = (Nothing :: Maybe v)

data Member :: Nat -> NatMap v -> Exp Bool Source #

Member

Example

Expand
>>> :kind! Eval (Member 5 =<< FromList '[ '(5,"a"), '(3,"b")])
Eval (Member 5 =<< FromList '[ '(5,"a"), '(3,"b")]) :: Bool
= 'True
>>> :kind! Eval (Member 7 =<< FromList '[ '(5,"a"), '(3,"b")])
Eval (Member 7 =<< FromList '[ '(5,"a"), '(3,"b")]) :: Bool
= 'False
Instances
type Eval (Member k mp :: Bool -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Member k mp :: Bool -> Type) = Eval (Elem k =<< Keys mp)

data NotMember :: Nat -> NatMap v -> Exp Bool Source #

NotMember

Example

Expand
>>> :kind! Eval (NotMember 5 =<< FromList '[ '(5,"a"), '(3,"b")])
Eval (NotMember 5 =<< FromList '[ '(5,"a"), '(3,"b")]) :: Bool
= 'False
>>> :kind! Eval (NotMember 7 =<< FromList '[ '(5,"a"), '(3,"b")])
Eval (NotMember 7 =<< FromList '[ '(5,"a"), '(3,"b")]) :: Bool
= 'True
Instances
type Eval (NotMember k mp :: Bool -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (NotMember k mp :: Bool -> Type) = Eval (Not =<< (Elem k =<< Keys mp))

data Disjoint :: NatMap v -> NatMap v -> Exp Bool Source #

Disjoint

Example

Expand
>>> :kind! Eval (Disjoint (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")])))
Eval (Disjoint (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")]))) :: Bool
= 'False
>>> :kind! Eval (Disjoint (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(2,"B"), '(7,"C")])))
Eval (Disjoint (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(2,"B"), '(7,"C")]))) :: Bool
= 'True
>>> :kind! Eval (Disjoint (Eval Empty) (Eval Empty))
Eval (Disjoint (Eval Empty) (Eval Empty)) :: Bool
= 'True
Instances
type Eval (Disjoint mp1 mp2 :: Bool -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Disjoint mp1 mp2 :: Bool -> Type) = Eval ((Null :: NatMap v -> Bool -> Type) =<< Intersection mp1 mp2)

data Elems :: NatMap v -> Exp [v] Source #

Elems

Example

Expand
>>> :kind! Eval (Elems =<< FromList '[ '(5,"a"), '(3,"b")])
Eval (Elems =<< FromList '[ '(5,"a"), '(3,"b")]) :: [Symbol]
= '["a", "b"]
>>> :kind! Eval (Elems =<< Empty)
Eval (Elems =<< Empty) :: [v]
= '[]
Instances
type Eval (Elems (NatMap lst) :: [b] -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Elems (NatMap lst) :: [b] -> Type) = Eval (Map (Snd :: (Nat, b) -> b -> Type) lst)

data Keys :: NatMap v -> Exp [Nat] Source #

Keys

Example

Expand
>>> :kind! Eval (Keys =<< FromList '[ '(5,"a"), '(3,"b")])
Eval (Keys =<< FromList '[ '(5,"a"), '(3,"b")]) :: [Nat]
= '[5, 3]
>>> :kind! Eval (Keys =<< Empty)
Eval (Keys =<< Empty) :: [Nat]
= '[]
Instances
type Eval (Keys (NatMap lst) :: [Nat] -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Keys (NatMap lst) :: [Nat] -> Type) = Eval (Map (Fst :: (Nat, b) -> Nat -> Type) lst)

data Assocs :: NatMap v -> Exp [(Nat, v)] Source #

Assocs

Example

Expand
>>> :kind! Eval (Assocs =<< FromList '[ '(5,"a"), '(3,"b")])
Eval (Assocs =<< FromList '[ '(5,"a"), '(3,"b")]) :: [(Nat, 
                                                       Symbol)]
= '[ '(5, "a"), '(3, "b")]
>>> :kind! Eval (Assocs =<< Empty)
Eval (Assocs =<< Empty) :: [(Nat, v)]
= '[]
Instances
type Eval (Assocs (NatMap lst) :: [(Nat, v)] -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Assocs (NatMap lst) :: [(Nat, v)] -> Type) = lst

Construction

data Empty :: Exp (NatMap v) Source #

Empty

Example

Expand
>>> :kind! (Eval Empty :: NatMap Symbol)
(Eval Empty :: NatMap Symbol) :: NatMap Symbol
= 'NatMap '[]
>>> :kind! (Eval Empty :: NatMap String)
(Eval Empty :: NatMap String) :: NatMap [Char]
= 'NatMap '[]

See also the other examples in this module.

Instances
type Eval (Empty :: NatMap v -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Empty :: NatMap v -> Type) = NatMap ([] :: [(Nat, v)])

data Singleton :: Nat -> v -> Exp (NatMap v) Source #

Singleton

Example

Expand
>>> :kind! Eval (Singleton 1 "haa")
Eval (Singleton 1 "haa") :: NatMap Symbol
= 'NatMap '[ '(1, "haa")]
Instances
type Eval (Singleton k v2 :: NatMap v1 -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Singleton k v2 :: NatMap v1 -> Type) = NatMap ((,) k v2 ': ([] :: [(Nat, v1)]))

data Insert :: Nat -> v -> NatMap v -> Exp (NatMap v) Source #

Insert

Example

Expand
>>> :kind! Eval (Insert 3 "hih" =<< FromList '[ '(1,"haa"), '(2,"hoo")])
Eval (Insert 3 "hih" =<< FromList '[ '(1,"haa"), '(2,"hoo")]) :: NatMap 
                                                                   Symbol
= 'NatMap '[ '(3, "hih"), '(1, "haa"), '(2, "hoo")]
Instances
type Eval (Insert k v2 (NatMap lst) :: NatMap v1 -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Insert k v2 (NatMap lst) :: NatMap v1 -> Type) = If (Eval (Elem k =<< Map (Fst :: (Nat, v1) -> Nat -> Type) lst)) (NatMap lst) (NatMap ((,) k v2 ': lst))

data InsertWith :: (v -> v -> Exp v) -> Nat -> v -> NatMap v -> Exp (NatMap v) Source #

InsertWith

if old there, map

if no old, add

Example

Expand
>>> :kind! Eval (InsertWith Append 5 "xxx" =<< FromList '[ '(5,"a"), '(3,"b")])
Eval (InsertWith Append 5 "xxx" =<< FromList '[ '(5,"a"), '(3,"b")]) :: NatMap
                                                                          Symbol
= 'NatMap '[ '(5, "xxxa"), '(3, "b")]
>>> :kind! Eval (InsertWith Append 7 "xxx" =<< FromList '[ '(5,"a"), '(3,"b")])
Eval (InsertWith Append 7 "xxx" =<< FromList '[ '(5,"a"), '(3,"b")]) :: NatMap
                                                                          Symbol
= 'NatMap '[ '(5, "a"), '(3, "b"), '(7, "xxx")]
>>> :kind! Eval (InsertWith Append 7 "xxx" =<< Empty)
Eval (InsertWith Append 7 "xxx" =<< Empty) :: NatMap Symbol
= 'NatMap '[ '(7, "xxx")]
Instances
type Eval (InsertWith f k v2 (NatMap lst) :: NatMap v1 -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (InsertWith f k v2 (NatMap lst) :: NatMap v1 -> Type)

data Delete :: Nat -> NatMap v -> Exp (NatMap v) Source #

Delete

Example

Expand
>>> :kind! Eval (Delete 5 =<< FromList '[ '(5,"a"), '(3,"b")])
Eval (Delete 5 =<< FromList '[ '(5,"a"), '(3,"b")]) :: NatMap
                                                         Symbol
= 'NatMap '[ '(3, "b")]
>>> :kind! Eval (Delete 7 =<< FromList '[ '(5,"a"), '(3,"b")])
Eval (Delete 7 =<< FromList '[ '(5,"a"), '(3,"b")]) :: NatMap
                                                         Symbol
= 'NatMap '[ '(5, "a"), '(3, "b")]
>>> :kind! Eval (Delete 7 =<< Empty)
Eval (Delete 7 =<< Empty) :: NatMap v
= 'NatMap '[]
Instances
type Eval (Delete k (NatMap lst) :: NatMap v -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Delete k (NatMap lst) :: NatMap v -> Type) = NatMap (Eval (Filter (Not <=< ((TyEq k :: Nat -> Bool -> Type) <=< (Fst :: (Nat, v) -> Nat -> Type))) lst))

Combine

data Union :: NatMap v -> NatMap v -> Exp (NatMap v) Source #

Union

Example

Expand
>>> :kind! Eval (Union (Eval (FromList '[ '(5,"a"), '(3,"b")])) (Eval (FromList '[ '(5,"A"), '(7,"c")])) )
Eval (Union (Eval (FromList '[ '(5,"a"), '(3,"b")])) (Eval (FromList '[ '(5,"A"), '(7,"c")])) ) :: NatMap 
                                                                                                     Symbol
= 'NatMap '[ '(7, "c"), '(5, "a"), '(3, "b")]
Instances
type Eval (Union (NatMap lst1) (NatMap lst2) :: NatMap v -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Union (NatMap lst1) (NatMap lst2) :: NatMap v -> Type)

data Difference :: NatMap v -> NatMap v -> Exp (NatMap v) Source #

Difference

Example

Expand
>>> :kind! Eval (Difference (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")])))
Eval (Difference (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")]))) :: NatMap 
                                                                                                         Symbol
= 'NatMap '[ '(3, "a")]
Instances
type Eval (Difference mp1 mp2 :: NatMap v -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Difference mp1 mp2 :: NatMap v -> Type)

data Intersection :: NatMap v -> NatMap v -> Exp (NatMap v) Source #

Intersection

Example

Expand
>>> :kind! Eval (Intersection (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")])))
Eval (Intersection (Eval (FromList '[ '(3,"a"), '(5,"b")])) (Eval (FromList '[ '(5,"B"), '(7,"C")]))) :: NatMap 
                                                                                                           Symbol
= 'NatMap '[ '(5, "b")]
Instances
type Eval (Intersection mp1 mp2 :: NatMap v -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Intersection mp1 mp2 :: NatMap v -> Type)

Modify

data Adjust :: (v -> Exp v) -> Nat -> NatMap v -> Exp (NatMap v) Source #

Adjust

Example

Expand
>>> :kind! Eval (Adjust (Append "new ") 5 =<< FromList '[ '(5,"a"), '(3,"b")])
Eval (Adjust (Append "new ") 5 =<< FromList '[ '(5,"a"), '(3,"b")]) :: NatMap
                                                                         Symbol
= 'NatMap '[ '(5, "new a"), '(3, "b")]
>>> :kind! Eval (Adjust (Append "new ") 7 =<< FromList '[ '(5,"a"), '(3,"b")])
Eval (Adjust (Append "new ") 7 =<< FromList '[ '(5,"a"), '(3,"b")]) :: NatMap
                                                                         Symbol
= 'NatMap '[ '(5, "a"), '(3, "b")]
>>> :kind! Eval (Adjust (Append "new ") 7 =<< Empty)
Eval (Adjust (Append "new ") 7 =<< Empty) :: NatMap Symbol
= 'NatMap '[]
Instances
type Eval (Adjust f k (NatMap lst) :: NatMap v -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Adjust f k (NatMap lst) :: NatMap v -> Type)

data Map :: (v -> Exp w) -> NatMap v -> Exp (NatMap w) Source #

Map

Example

Expand
>>> :kind! Eval (Fcf.Data.NatMap.Map (Append "x") =<< FromList '[ '(5,"a"), '(3,"b")])
Eval (Fcf.Data.NatMap.Map (Append "x") =<< FromList '[ '(5,"a"), '(3,"b")]) :: NatMap 
                                                                                 Symbol
= 'NatMap '[ '(5, "xa"), '(3, "xb")]
Instances
type Eval (Map f mp :: NatMap v2 -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Map f mp :: NatMap v2 -> Type) = NatMap (Eval ((Map (Second f :: (Nat, v1) -> (Nat, v2) -> Type) :: [(Nat, v1)] -> [(Nat, v2)] -> Type) =<< Assocs mp))

data NatMapWithKey :: (Nat -> v -> Exp w) -> NatMap v -> Exp (NatMap w) Source #

NatMapWithKey

Example

Instances
type Eval (NatMapWithKey f mp :: NatMap v2 -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (NatMapWithKey f mp :: NatMap v2 -> Type)

data Foldr :: (v -> w -> Exp w) -> w -> NatMap v -> Exp w Source #

Foldr

Fold the values in the map using the given right-associative binary operator, such that 'foldr f z == foldr f z . elems'.

Note: the order of values in NatMap is not well defined at the moment.

Example

Expand
>>> :kind! Eval (Fcf.Data.NatMap.Foldr (+) 0  =<< (FromList '[ '(1,1), '(2,2)]))
Eval (Fcf.Data.NatMap.Foldr (+) 0  =<< (FromList '[ '(1,1), '(2,2)])) :: Nat
= 3
Instances
type Eval (Foldr f w mp :: a -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Foldr f w mp :: a -> Type) = Eval ((Foldr f w :: [v] -> a -> Type) =<< Elems mp)

data Filter :: (v -> Exp Bool) -> NatMap v -> Exp (NatMap v) Source #

Filter

Example

Expand
>>> :kind! Eval (Filter ((>=) 35) =<< FromList '[ '(5,50), '(3,30)])
Eval (Filter ((>=) 35) =<< FromList '[ '(5,50), '(3,30)]) :: NatMap 
                                                               Nat
= 'NatMap '[ '(3, 30)]
Instances
type Eval (Filter f (NatMap lst) :: NatMap v -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Filter f (NatMap lst) :: NatMap v -> Type) = NatMap (Eval (Filter (f <=< (Snd :: (Nat, v) -> v -> Type)) lst))

data FilterWithKey :: (Nat -> v -> Exp Bool) -> NatMap v -> Exp (NatMap v) Source #

FilterWithKey

Example

Expand
>>> :kind! Eval (FilterWithKey (>=) =<< FromList '[ '(3,5), '(6,4)])
Eval (FilterWithKey (>=) =<< FromList '[ '(3,5), '(6,4)]) :: NatMap
                                                               Nat
= 'NatMap '[ '(6, 4)]
Instances
type Eval (FilterWithKey f (NatMap lst) :: NatMap v -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (FilterWithKey f (NatMap lst) :: NatMap v -> Type) = NatMap (Eval (Filter (Uncurry f) lst))

data Partition :: (v -> Exp Bool) -> NatMap v -> Exp (NatMap v, NatMap v) Source #

Partition

Example

Expand
>>> :kind! Eval (Partition ((>=) 35) =<< FromList '[ '(5,50), '(3,30)])
Eval (Partition ((>=) 35) =<< FromList '[ '(5,50), '(3,30)]) :: (NatMap 
                                                                   Nat, 
                                                                 NatMap Nat)
= '( 'NatMap '[ '(3, 30)], 'NatMap '[ '(5, 50)])
Instances
type Eval (Partition f (NatMap lst) :: (NatMap v, NatMap v) -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (Partition f (NatMap lst) :: (NatMap v, NatMap v) -> Type)

List

data FromList :: [(Nat, v)] -> Exp (NatMap v) Source #

Use FromList to construct a NatMap from type-level list.

Example

Expand
>>> :kind! Eval (FromList '[ '(1,"haa"), '(2,"hoo")])
Eval (FromList '[ '(1,"haa"), '(2,"hoo")]) :: NatMap Symbol
= 'NatMap '[ '(1, "haa"), '(2, "hoo")]
Instances
type Eval (FromList lst :: NatMap v -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (FromList lst :: NatMap v -> Type) = NatMap lst

data ToList :: NatMap v -> Exp [(Nat, v)] Source #

ToList

Example

Expand
>>> :kind! Eval (ToList =<< FromList '[ '(5,"a"), '(3,"b")])
Eval (ToList =<< FromList '[ '(5,"a"), '(3,"b")]) :: [(Nat, 
                                                       Symbol)]
= '[ '(5, "a"), '(3, "b")]
>>> :kind! Eval (ToList =<< Empty)
Eval (ToList =<< Empty) :: [(Nat, v)]
= '[]
Instances
type Eval (ToList (NatMap lst) :: [(Nat, v)] -> Type) Source # 
Instance details

Defined in Fcf.Data.NatMap

type Eval (ToList (NatMap lst) :: [(Nat, v)] -> Type) = lst