prosidy-1.6.0.2: A simple language for writing documents.
Copyright©2020 James Alexander Feldman-Crough
LicenseMPL-2.0
Maintaineralex@fldcr.com
Safe HaskellSafe
LanguageHaskell2010

Prosidy.Types.Assoc

Description

 
Synopsis

Documentation

newtype Assoc k v Source #

An associative mapping of keys to values.

Currently implemented as a HashMap, this newtype wrapper allows us to:

1) Add non-orphan instances to the underlying structure. 2) Change the underlying type if needed.

Constructors

Assoc (HashMap k v) 

Instances

Instances details
Functor (Assoc k) Source # 
Instance details

Defined in Prosidy.Types.Assoc

Methods

fmap :: (a -> b) -> Assoc k a -> Assoc k b #

(<$) :: a -> Assoc k b -> Assoc k a #

Foldable (Assoc k) Source # 
Instance details

Defined in Prosidy.Types.Assoc

Methods

fold :: Monoid m => Assoc k m -> m #

foldMap :: Monoid m => (a -> m) -> Assoc k a -> m #

foldMap' :: Monoid m => (a -> m) -> Assoc k a -> m #

foldr :: (a -> b -> b) -> b -> Assoc k a -> b #

foldr' :: (a -> b -> b) -> b -> Assoc k a -> b #

foldl :: (b -> a -> b) -> b -> Assoc k a -> b #

foldl' :: (b -> a -> b) -> b -> Assoc k a -> b #

foldr1 :: (a -> a -> a) -> Assoc k a -> a #

foldl1 :: (a -> a -> a) -> Assoc k a -> a #

toList :: Assoc k a -> [a] #

null :: Assoc k a -> Bool #

length :: Assoc k a -> Int #

elem :: Eq a => a -> Assoc k a -> Bool #

maximum :: Ord a => Assoc k a -> a #

minimum :: Ord a => Assoc k a -> a #

sum :: Num a => Assoc k a -> a #

product :: Num a => Assoc k a -> a #

(Eq k, Eq v) => Eq (Assoc k v) Source # 
Instance details

Defined in Prosidy.Types.Assoc

Methods

(==) :: Assoc k v -> Assoc k v -> Bool #

(/=) :: Assoc k v -> Assoc k v -> Bool #

(Show k, Show v) => Show (Assoc k v) Source # 
Instance details

Defined in Prosidy.Types.Assoc

Methods

showsPrec :: Int -> Assoc k v -> ShowS #

show :: Assoc k v -> String #

showList :: [Assoc k v] -> ShowS #

Generic (Assoc k v) Source # 
Instance details

Defined in Prosidy.Types.Assoc

Associated Types

type Rep (Assoc k v) :: Type -> Type #

Methods

from :: Assoc k v -> Rep (Assoc k v) x #

to :: Rep (Assoc k v) x -> Assoc k v #

(Eq k, Hashable k) => Semigroup (Assoc k v) Source # 
Instance details

Defined in Prosidy.Types.Assoc

Methods

(<>) :: Assoc k v -> Assoc k v -> Assoc k v #

sconcat :: NonEmpty (Assoc k v) -> Assoc k v #

stimes :: Integral b => b -> Assoc k v -> Assoc k v #

(Eq k, Hashable k) => Monoid (Assoc k v) Source # 
Instance details

Defined in Prosidy.Types.Assoc

Methods

mempty :: Assoc k v #

mappend :: Assoc k v -> Assoc k v -> Assoc k v #

mconcat :: [Assoc k v] -> Assoc k v #

(Hashable k, Hashable v) => Hashable (Assoc k v) Source # 
Instance details

Defined in Prosidy.Types.Assoc

Methods

hashWithSalt :: Int -> Assoc k v -> Int #

hash :: Assoc k v -> Int #

(ToJSON v, ToJSONKey k) => ToJSON (Assoc k v) Source # 
Instance details

Defined in Prosidy.Types.Assoc

Methods

toJSON :: Assoc k v -> Value #

toEncoding :: Assoc k v -> Encoding #

toJSONList :: [Assoc k v] -> Value #

toEncodingList :: [Assoc k v] -> Encoding #

(FromJSON v, FromJSONKey k, Eq k, Hashable k) => FromJSON (Assoc k v) Source # 
Instance details

Defined in Prosidy.Types.Assoc

Methods

parseJSON :: Value -> Parser (Assoc k v) #

parseJSONList :: Value -> Parser [Assoc k v] #

(Eq k, Hashable k, Binary k, Binary v) => Binary (Assoc k v) Source # 
Instance details

Defined in Prosidy.Types.Assoc

Methods

put :: Assoc k v -> Put #

get :: Get (Assoc k v) #

putList :: [Assoc k v] -> Put #

(NFData k, NFData v) => NFData (Assoc k v) Source # 
Instance details

Defined in Prosidy.Types.Assoc

Methods

rnf :: Assoc k v -> () #

(Pretty k, Pretty v) => Pretty (Assoc k v) Source # 
Instance details

Defined in Prosidy.Types.Assoc

Methods

pretty :: Assoc k v -> Doc ann #

prettyList :: [Assoc k v] -> Doc ann #

type Rep (Assoc k v) Source # 
Instance details

Defined in Prosidy.Types.Assoc

type Rep (Assoc k v) = D1 ('MetaData "Assoc" "Prosidy.Types.Assoc" "prosidy-1.6.0.2-inplace" 'True) (C1 ('MetaCons "Assoc" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (HashMap k v))))

asHashMap :: Functor f => (HashMap k v -> f (HashMap k' v')) -> Assoc k v -> f (Assoc k' v') Source #

Given a function which operates on a HashMap, return a function which performs an equivalent transfromation on an Assoc.

fromHashMap :: HashMap k v -> Assoc k v Source #

Convert a HashMap to an Assoc.

toHashMap :: Assoc k v -> HashMap k v Source #

Convert an Assoc to a HashMap.

toEntries :: Assoc k v -> [(k, v)] Source #

Convert an Assoc into a list of key/value pairs.