Karya, built on 2023-08-29T07:47:28 (patch 7a412d5d6ba4968ca4155ef276a062ccdeb9109a)
Safe HaskellSafe-Inferred

Derive.Parse.Instruments

Contents

Description

Parsing support for the "instrument:" section of the ky file.

This is an awkward hybrid. Firstly, the name is inconsistent, internally they are called "allocation" because "instrument" usually corresponds to ScoreT.Instrument, while the allocation is the thing tying instrument to patch. But at the UI level I find "allocation" too vague and use "instrument" for both concepts.

But the main thing is that Allocation corresponds only to a subset of the actual Allocation. The real source of truth is UiConfig.Allocation. So the ky equivalent has to merge in any changes that may have happened to the config (done in Parse.Ky.merge_instruments), which means automatically updating source, which is fiddly as usual.

A more traditional and simpler way would be to make the ky source be the source of truth, but that would mean having it serialize all the fields. I got pretty far down this route, but it got pretty complicated because there's a whole new expression language and serialization layer, and I become unsure if it was really a good idea.

So we do complicated merging for now.

Synopsis

Documentation

data Allocation Source #

This is a simplified subset of Allocation.

Instances

Instances details
Show Allocation Source # 
Instance details

Defined in Derive.Parse.Instruments

Eq Allocation Source # 
Instance details

Defined in Derive.Parse.Instruments

data Config Source #

Subset of Config.

Constructors

Config 

Fields

Instances

Instances details
Show Config Source # 
Instance details

Defined in Derive.Parse.Instruments

Eq Config Source # 
Instance details

Defined in Derive.Parse.Instruments

Methods

(==) :: Config -> Config -> Bool #

(/=) :: Config -> Config -> Bool #

data Backend Source #

Instances

Instances details
Show Backend Source # 
Instance details

Defined in Derive.Parse.Instruments

Eq Backend Source # 
Instance details

Defined in Derive.Parse.Instruments

Methods

(==) :: Backend -> Backend -> Bool #

(/=) :: Backend -> Backend -> Bool #

update_ui :: LookupBackend -> [Allocation] -> UiConfig.Allocations -> Either Error UiConfig.Allocations Source #

Merge the Allocations parsed from the instrument section into the Ui level config.

parse

spaces :: Parser () Source #