| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Harmonic.Rules.Types.ProgressionContext
Description
A ProgressionContext bundles three bar-aligned Progression layers —
triads, pentatonic strata, and diatonic modes — together with optional
per-bar provenance tracking which tristrata and strata each bar was drawn
from. The legacy gen paradigm produces contexts where all three layers
duplicate the same triad progression and provenance is Nothing; the new
genP paradigm (introduced by the octatripentatonic framework) produces
contexts with distinct strata/mode layers and Just provenance.
Synopsis
- data Layer
- data ProgressionContext = ProgressionContext {}
- layer :: Layer -> ProgressionContext -> Progression
- pcLength :: ProgressionContext -> Int
- fromProgression :: Progression -> ProgressionContext
- liftPC :: (Progression -> Progression) -> ProgressionContext -> ProgressionContext
- pcSplice :: ProgressionContext -> Int -> Int -> ProgressionContext -> ProgressionContext
Documentation
Layer tag selecting one of the three progression layers at a call site.
T— Triad layer (cadential harmony, the Rules.Types.Progression result).S— Strata layer (5-note pentatonic chroma, one stratum per bar).M— Mode layer (7-note diatonic chroma, the pair-union mode).
M replaces the plan's D to avoid clashing with NoteName
(D natural), which is re-exported via Lib for live-coding use.
data ProgressionContext Source #
Three bar-aligned progression layers with optional per-bar provenance.
Invariant: progLength triadLayer == progLength strataLayer == progLength modeLayer,
and when pcProvenance = Just seq, Seq.length seq == progLength triadLayer.
Constructors
| ProgressionContext | |
Fields
| |
Instances
| Monoid ProgressionContext Source # | |
Defined in Harmonic.Rules.Types.ProgressionContext Methods mempty :: ProgressionContext # mappend :: ProgressionContext -> ProgressionContext -> ProgressionContext # mconcat :: [ProgressionContext] -> ProgressionContext # | |
| Semigroup ProgressionContext Source # | |
Defined in Harmonic.Rules.Types.ProgressionContext Methods (<>) :: ProgressionContext -> ProgressionContext -> ProgressionContext # sconcat :: NonEmpty ProgressionContext -> ProgressionContext # stimes :: Integral b => b -> ProgressionContext -> ProgressionContext # | |
| Show ProgressionContext Source # | |
Defined in Harmonic.Rules.Types.ProgressionContext Methods showsPrec :: Int -> ProgressionContext -> ShowS # show :: ProgressionContext -> String # showList :: [ProgressionContext] -> ShowS # | |
| Eq ProgressionContext Source # | |
Defined in Harmonic.Rules.Types.ProgressionContext Methods (==) :: ProgressionContext -> ProgressionContext -> Bool # (/=) :: ProgressionContext -> ProgressionContext -> Bool # | |
layer :: Layer -> ProgressionContext -> Progression Source #
Project a ProgressionContext to a single Progression by layer tag.
pcLength :: ProgressionContext -> Int Source #
Bar count — equal across all three layers by invariant.
fromProgression :: Progression -> ProgressionContext Source #
Wrap a single Progression as a ProgressionContext by duplicating it
into all three layers with no provenance. Used by the legacy gen paradigm
and by test fixtures migrating to the widened type.
liftPC :: (Progression -> Progression) -> ProgressionContext -> ProgressionContext Source #
Apply a Progression-transforming function pointwise across all three
layers. Drops provenance — specific Class 1 combinators that preserve bar
alignment should permute provenance directly rather than going through
liftPC.
pcSplice :: ProgressionContext -> Int -> Int -> ProgressionContext -> ProgressionContext Source #
Splice a range of bars within a ProgressionContext, replacing the
triad / strata / mode layers and the pcProvenance sequence in lockstep.
Range is 1-indexed and wrap-aware (mirrors spliceProgression):
- Non-wrapping (
start <= end): replaces positionsstart..end. - Wrapping (
start > end): replacesstart..Nand1..end.
The triad layer's movement seam is fixed via spliceProgression;
strata / mode layers don't carry meaningful Movement state (their
Cadence is built with Movement = Unison — see mkChromaCS in
Builder) so they use a plain sequence splice.
Provenance follows the same geometry. When either side has
pcProvenance = Nothing, the result is Nothing (the splice can't
reconstruct provenance from a layer-only source).
Caller is responsible for ensuring the inserted ProgressionContext
has length equal to the range size.