Data.Abc.Optics
- Package
- purescript-abc-parser
- Repository
- newlandsvalley/purescript-abc-parser
Optics for accessing the tune headers
ABC allows for multiple headers of the same type to exist: https://abcnotation.com/wiki/abc:standard:v2.1#file_header It's not clear how you should discriminate between them if, for example, you want to display the main tune header on a score. I use the convention that the first header to be defined is the prominent one.
It's also probably not necessary that optics are needed to retrieve components of the tune body because it's almost always necessary to process this serially.
Usage requires profunctor-optics.
To retrieve the first title:
firstOf (headers <<< traversed <<< Title) abcTune
To retrieve all the titles into a list:
toListOf (headers <<< traversed <<< Title) abcTune
Or to get the tune mode:
firstOf (headers <<< traversed <<< ModifiedKeySignature <<< keySignature <<< mode) abcTune
Or to reset the title of a tune:
set (headers <<< traversed <<< Title) "new title" abcTune
#_keySignature Source
_keySignature :: forall a r. Lens' { keySignature :: a | r } amodified Key signature fields the underlying key signature
#_keySignatureModifications Source
_keySignatureModifications :: forall a r. Lens' { modifications :: a | r } amodifications to the key signature
#_pitchClass Source
_pitchClass :: forall a r. Lens' { pitchClass :: a | r } athe pitch class e.g. A
#_accidental Source
_accidental :: forall a r. Lens' { accidental :: a | r } a#_noteLengths Source
_noteLengths :: forall a r. Lens' { noteLengths :: a | r } a#_properties Source
_properties :: forall a r. Lens' { properties :: a | r } akey signature or voice description properties
- Modules
- Data.
Abc - Data.
Abc. Accidentals - Data.
Abc. Canonical - Data.
Abc. KeySignature - Data.
Abc. Meter - Data.
Abc. Midi - Data.
Abc. Midi. Pitch - Data.
Abc. Midi. RepeatSections - Data.
Abc. Midi. Types - Data.
Abc. Octave - Data.
Abc. Optics - Data.
Abc. Parser - Data.
Abc. Repeats. Section - Data.
Abc. Repeats. Types - Data.
Abc. Repeats. Variant - Data.
Abc. Tempo - Data.
Abc. Transposition - Data.
Abc. UnitNote - Data.
Abc. Utils - Data.
Abc. Voice