proto-voice-model-0.1.0.0
Safe HaskellSafe-Inferred
LanguageGHC2021

PVGrammar.Parse

Description

This module contains code that is specific to parsing the protovoice grammar. It implements a number of evaluators (Eval) that can be used with the various parsers.

Synopsis

Generic Parsing

Evaluators that directly return protovoice operations. They can be embedded into a semiring using mapEvalScore.

type IsNote n = (HasPitch n, Diatonic (ICOf (IntervalOf n)), Eq (ICOf (IntervalOf n))) Source #

A constraint alias for note types.

protoVoiceEvaluator :: (Foldable t, Foldable t2, Eq n, Ord n, IsNote n, Notation n, Hashable n) => Eval (Edges n) (t (Edge n)) (Notes n) (t2 n) (PVLeftmost n) Source #

The evaluator that represents the proto-voice grammar. As scores it returns a representation of each operation. These scores do not form a semiring, but can be embedded into different semirings using mapEvalScore.

protoVoiceEvaluatorNoRepSplit :: (Foldable t, Foldable t2, Eq n, Ord n, IsNote n, Notation n, Hashable n) => Eval (Edges n) (t (Edge n)) (Notes n) (t2 n) (PVLeftmost n) Source #

A restricted version of the PV evaluator that prohibits split operations in which one of the parent slices is repeated entirely.

Parsing Derivations

pvDerivUnrestricted :: (Foldable t, Foldable t2, Eq n, Ord n, IsNote n, Notation n, Hashable n) => Eval (Edges n) (t (Edge n)) (Notes n) (t2 n) (Derivations (PVLeftmost n)) Source #

An evaluator for protovoices that produces values in the Derivations semiring.

pvDerivRightBranch :: (Foldable t, Foldable t2, Eq n, Ord n, IsNote n, Notation n, Hashable n) => Eval (Merged, (RightBranchSpread, Edges n)) (t (Edge n)) ((), ((), Notes n)) (t2 n) (Derivations (PVLeftmost n)) Source #

An evaluator for protovoices that produces values in the Derivations semiring.

Counting Parses

pvCountUnrestricted :: (Foldable t, Foldable t2, Eq n, Ord n, IsNote n, Notation n, Hashable n) => Eval (Edges n) (t (Edge n)) (Notes n) (t2 n) Int Source #

An evaluator for protovoices that produces values in the counting semiring.

pvCountNoRepSplit :: (Foldable t, Foldable t2, Eq n, Ord n, IsNote n, Notation n, Hashable n) => Eval (Edges n) (t (Edge n)) (Notes n) (t2 n) Int Source #

An evaluator for protovoices that produces values in the counting semiring.

pvCountNoRepSplitRightBranch :: (Foldable t, Foldable t2, Eq n, Ord n, IsNote n, Notation n, Hashable n) => Eval (RightBranchSpread, Edges n) (t (Edge n)) ((), Notes n) (t2 n) Int Source #

An evaluator for protovoices that produces values in the counting semiring.

pvCountNoRepSplitRightBranchSplitFirst :: (Foldable t, Foldable t2, Eq n, Ord n, IsNote n, Notation n, Hashable n) => Eval (Merged, (RightBranchSpread, Edges n)) (t (Edge n)) ((), ((), Notes n)) (t2 n) Int Source #

An evaluator for protovoices that produces values in the counting semiring.