module Cmd.Repl.Util where
import qualified Data.Map as Map
import qualified Data.Text as Text
import qualified Derive.ScoreT as ScoreT
import qualified Ui.Id as Id
import Global
type Instrument = Text
instrument :: Instrument -> ScoreT.Instrument
instrument :: Instrument -> Instrument
instrument = Instrument -> Instrument
ScoreT.Instrument forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool) -> Instrument -> Instrument
Text.dropWhile (forall a. Eq a => a -> a -> Bool
==Char
'>')
match_map :: Id.Ident id => Text -> Map id a -> Map id a
match_map :: forall id a. Ident id => Instrument -> Map id a -> Map id a
match_map Instrument
match = forall k a. (k -> a -> Bool) -> Map k a -> Map k a
Map.filterWithKey (\id
k a
_ -> forall id. Ident id => Instrument -> id -> Bool
match_id Instrument
match id
k)
match_id :: Id.Ident id => Text -> id -> Bool
match_id :: forall id. Ident id => Instrument -> id -> Bool
match_id Instrument
sub = (Instrument
sub `Text.isInfixOf`) forall b c a. (b -> c) -> (a -> b) -> a -> c
. Id -> Instrument
Id.show_id forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Ident a => a -> Id
Id.unpack_id