Karya, built on 2022-03-21T01:30:44 (patch 89d1651424c35e564138d93424a157ff87457245)
Safe HaskellSafe-Inferred



Pull deriver call documentation out of a Performance and format it nicely.



doc_text :: Document -> Lazy.Text Source #

Convert a Document to plain text.

show_parser Source #


:: ArgParser 
-> (Maybe.Maybe Text, Maybe.Maybe Text)

(superscript to mark this arg, default value)

bindings_text :: Document -> Text Source #

Print an abbreviated list of calls, grouped by namespace and ordered by shadowing priority. Should look like:

    note generator
n -- note (instrument) [inst] When the event has zero duration, dispatc...
n -- note (imported) [prelude] The note call is the main note generator...
    note transformer
n -- note-attributes (imported) [prelude] This is similar to to `=`, bu...

html output

doc_html :: Html.HtmlState -> Document -> Html.Html Source #

Convert a Document to HTML.

binding_tags :: CallBindings -> [Text] Source #

Extract explicit tags as well as some implicit tags. Implicit tags are %control for controls in the default arguments, name-arg for environ keys that default the arguments, and note, control, pitch, or val for the call kind.

scale doc

scale_docs :: [(Pitch.ScaleId, Text, DocumentedCall)] -> [CallBindings] Source #

Extract documentation from scales.


type Document = [Section] Source #

An intermediate format between Scopes and the eventual textual output.

type CallKind = Text Source #

From the fields of Scope and Scopes: note, control, pitch, or val.

type ScopeDoc = (ScopeSource, [CallBindings]) Source #

Documentation for one type of scope.

type ScopeSource = Maybe.Maybe CallPriority Source #

Nothing is when the source is irrelevant, so don't put it in the docs.

type CallBindings = ([Binding], CallType, CallDoc) Source #

Multiple bound symbols with the same DocumentedCall are grouped together:

type SymbolName = Text Source #

This is the name the call is bound to.

data CallType Source #


Instances details
Show CallType Source # 
Instance details

Defined in Cmd.CallDoc

Eq CallType Source # 
Instance details

Defined in Cmd.CallDoc

Ord CallType Source # 
Instance details

Defined in Cmd.CallDoc

Pretty CallType Source # 
Instance details

Defined in Cmd.CallDoc


filter_calls :: (SymbolName -> CallName -> Bool) -> Document -> Document Source #

Keep only CallDocs whose name or binding name matches the function.

builtins :: Builtins -> [Section] Source #

Extract all the documentation from the Builtins. Document extraction is a big mess of walking over nested data and converting it to a parallel nested data structure. It's tedious, but the types make it hard to get wrong.

convert_modules :: CallType -> (call -> DocumentedCall) -> Map mod (CallMap call) -> [ScopeDoc] Source #

scope :: Map Module.Module (CallMap (Call gen)) -> Map Module.Module (CallMap (Call trans)) -> Map Module.Module (CallMap (TrackCall track)) -> [ScopeDoc] Source #

Create docs for generator, transformer, and track calls, and merge and sort them.

type Entry = Library.Entry DocumentedCall Source #

A Library.Entry with the call stripped out and replaced with just documentation. This is so Calls and ValCalls can be treated uniformly.

entry_doc :: (call -> DocumentedCall) -> Library.Entry call -> Entry Source #

Convert Library.Entry to Entry by stripping out the code part of the call, and replacing it with DocumentedCall.

instrument doc

instrument_calls :: InstrumentCalls -> Document Source #

Get docs for the calls introduced by an instrument.

track doc

track :: Cmd.M m => BlockId -> TrackId -> m Document Source #

Get documentation for calls in scope at the given block and track.

track_sections :: ParseTitle.Type -> Scopes -> [Section] Source #

This is an alternate doc extraction path which extracts the docs from Scopes instead of Builtins.

merged_scope_docs :: [(CallType, ScopePriority DocumentedCall)] -> [ScopeDoc] Source #

Create docs for generator and transformer calls, and merge and sort them.

imported_scope_doc :: CallType -> [Entry] -> [ScopeDoc] Source #

A Library only has builtins, but ScopeDoc wants a source so it can work uniformly with track_sections, which does have separate sources.