-- | Map functions.
module Music.Theory.Map where

import qualified Data.Map as M {- containers -}
import Data.Maybe {- base -}

-- | Erroring 'M.lookup'.
map_lookup_err :: Ord k => k -> M.Map k c -> c
map_lookup_err :: forall k c. Ord k => k -> Map k c -> c
map_lookup_err k
k = forall a. a -> Maybe a -> a
fromMaybe (forall a. HasCallStack => [Char] -> a
error [Char]
"M.lookup") forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k a. Ord k => k -> Map k a -> Maybe a
M.lookup k
k

-- | 'flip' of 'M.lookup'.
map_ix :: Ord k => M.Map k c -> k -> Maybe c
map_ix :: forall k c. Ord k => Map k c -> k -> Maybe c
map_ix = forall a b c. (a -> b -> c) -> b -> a -> c
flip forall k a. Ord k => k -> Map k a -> Maybe a
M.lookup

-- | 'flip' of 'map_lookup_err'.
map_ix_err :: Ord k => M.Map k c -> k -> c
map_ix_err :: forall k c. Ord k => Map k c -> k -> c
map_ix_err = forall a b c. (a -> b -> c) -> b -> a -> c
flip forall k c. Ord k => k -> Map k c -> c
map_lookup_err