Module

Data.Abc.Optics

Package
purescript-abc-parser
Repository
newlandsvalley/purescript-abc-parser

Optics for accessing the tune headers

Remember that ABC allows for multiple headers of the same type to exist. 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

#_headers Source

_headers :: forall a r. Lens' { headers :: a | r } a

the tune headers

#_body Source

_body :: forall a r. Lens' { body :: a | r } a

the tune body

#_Area Source

_Area :: Prism' Header String

specific headers

#_keySignature Source

_keySignature :: forall a r. Lens' { keySignature :: a | r } a

modified Key signature fields the underlying key signature

#_keySignatureModifications Source

_keySignatureModifications :: forall a r. Lens' { modifications :: a | r } a

modifications to the key signature

#_pitchClass Source

_pitchClass :: forall a r. Lens' { pitchClass :: a | r } a

the pitch class e.g. A

#_accidental Source

_accidental :: forall a r. Lens' { accidental :: a | r } a

#_mode Source

_mode :: forall a r. Lens' { mode :: a | r } a

#_bpm Source

_bpm :: forall a r. Lens' { bpm :: a | r } a

Tempo signature fields

#_noteLengths Source

_noteLengths :: forall a r. Lens' { noteLengths :: a | r } a

#_marking Source

_marking :: forall a r. Lens' { marking :: a | r } a

#_id Source

_id :: forall a r. Lens' { id :: a | r } a

Voice fields

#_properties Source

_properties :: forall a r. Lens' { properties :: a | r } a

key signature or voice description properties