kmonad-0.4.1: Advanced keyboard remapping utility

Copyright(c) David Janssen 2019
LicenseMIT
Maintainerjanssen.dhj@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Data.MultiMap

Contents

Description

This datastructure represents a `k -> Set v` mapping: that is to say, each key can have multiple values (but no duplicates). Additionally, we provide some operations to reverse this mapping.

In KMonad we use this exclusively to easily define multiple names for the same Keycode in a reversible manner.

Synopsis

Types

 

data MultiMap k v Source #

The MultiMap, which describes a one to many (unique) mapping

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

Defined in Data.MultiMap

Methods

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

show :: MultiMap k v -> String #

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

CanMM k v => Semigroup (MultiMap k v) Source # 
Instance details

Defined in Data.MultiMap

Methods

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

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

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

CanMM k v => Monoid (MultiMap k v) Source # 
Instance details

Defined in Data.MultiMap

Methods

mempty :: MultiMap k v #

mappend :: MultiMap k v -> MultiMap k v -> MultiMap k v #

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

CanMM k v => Ixed (MultiMap k v) Source # 
Instance details

Defined in Data.MultiMap

Methods

ix :: Index (MultiMap k v) -> Traversal' (MultiMap k v) (IxValue (MultiMap k v)) #

CanMM k v => At (MultiMap k v) Source # 
Instance details

Defined in Data.MultiMap

Methods

at :: Index (MultiMap k v) -> Lens' (MultiMap k v) (Maybe (IxValue (MultiMap k v))) #

type Index (MultiMap k v) Source # 
Instance details

Defined in Data.MultiMap

type Index (MultiMap k v) = k
type IxValue (MultiMap k v) Source # 
Instance details

Defined in Data.MultiMap

type IxValue (MultiMap k v) = HashSet v

mkMultiMap :: (Foldable t1, Foldable t2, CanMM k v) => t1 (k, t2 v) -> MultiMap k v Source #

Create a new multimap from a foldable of (k, foldable v) pairs.

fromSingletons :: (Foldable t, CanMM k v) => t (k, v) -> MultiMap k v Source #

Create a new multimap from a foldable of (k, v) pairs

Operations on MultiMaps

 

itemed :: CanMM k v => Fold (MultiMap k v) (k, v) Source #

A fold over all the (k, v) pairs in a MultiMap

reverse :: (CanMM k v, CanMM v k) => MultiMap k v -> MultiMap v k Source #

Reverse a MultiMap. Note: this is not necessarily a lossless conversion.