]> Git — Sourcephile - tmp/julm/arpeggigon.git/blob - Reactogon/Translator/Auxiliary.hs
Update README.md
[tmp/julm/arpeggigon.git] / Reactogon / Translator / Auxiliary.hs
1 module Auxiliary ( breakMap
2 )where
3
4 import Control.Arrow
5 import Data.Map (Map)
6 import qualified Data.Map as M
7
8 dupl :: (Arrow a) => a b c -> a (b,b) (c,c)
9 dupl f = f *** f
10
11 breakMap :: (Ord k) => k -> Map k a -> (Map k a, Map k a)
12 breakMap k m = (smaller, larger')
13 where (smaller, maybeValue, larger) = M.splitLookup k m
14 larger' = maybe larger (\v -> M.insert k v larger) maybeValue