Karya, built on 2023-08-29T07:47:28 (patch 7a412d5d6ba4968ca4155ef276a062ccdeb9109a)
Safe HaskellSafe-Inferred

Derive.Library

Contents

Description

Utilities for the Library type.

Synopsis

make

type Library = ScopesT (Scope [Entry (Generator Note)] [Entry (Generator Control)] [Entry (Generator Pitch)]) (Scope [Entry (Transformer Note)] [Entry (Transformer Control)] [Entry (Transformer Pitch)]) (Scope [Entry (TrackCall Note)] [Entry (TrackCall Control)] [Entry (TrackCall Pitch)]) [Entry ValCall] Source #

The holds the libary of statically-declared calls. It gets compiled to Builtins by compile.

library :: ToLibrary call => [(Expr.Symbol, call)] -> Library Source #

generators :: ToLibrary (Generator call) => [(Expr.Symbol, Generator call)] -> Library Source #

This is just a specialization of library, just for documentation.

transformers :: ToLibrary (Transformer call) => [(Expr.Symbol, Transformer call)] -> Library Source #

This is just a specialization of library, just for documentation.

vals :: [(Expr.Symbol, ValCall)] -> Library Source #

This is just a specialization of library, just for documentation.

class ToLibrary call Source #

Minimal complete definition

to_library

Instances

Instances details
ToLibrary ValCall Source # 
Instance details

Defined in Derive.Library

ToLibrary (Generator Control) Source # 
Instance details

Defined in Derive.Library

ToLibrary (Generator Note) Source # 
Instance details

Defined in Derive.Library

ToLibrary (Generator Pitch) Source # 
Instance details

Defined in Derive.Library

ToLibrary (TrackCall Control) Source # 
Instance details

Defined in Derive.Library

ToLibrary (TrackCall Note) Source # 
Instance details

Defined in Derive.Library

ToLibrary (TrackCall Pitch) Source # 
Instance details

Defined in Derive.Library

ToLibrary (Transformer Control) Source # 
Instance details

Defined in Derive.Library

ToLibrary (Transformer Note) Source # 
Instance details

Defined in Derive.Library

ToLibrary (Transformer Pitch) Source # 
Instance details

Defined in Derive.Library

data Entry call Source #

Constructors

Single !Expr.Symbol !call 
Pattern !(PatternCall call) 

Instances

Instances details
Show Library Source # 
Instance details

Defined in Derive.Library

Pretty (Entry call) Source # 
Instance details

Defined in Derive.Library

Methods

pretty :: Entry call -> Text Source #

format :: Entry call -> Doc Source #

formatList :: [Entry call] -> Doc Source #

data Calls d Source #

Bundle a generator and transformer together, so I can define them together. Functions to create these are in Derive.Call.Make.

Constructors

Calls 

Fields

poly_generators :: (forall d. CallableExpr d => [(Expr.Symbol, Generator d)]) -> Library Source #

Add a polymorphic generator to all call types.

The Callable constraint is not needed here, but callers will have it, and for some reason you can't coerce a parametric variable into a constrained one.

compile

type Shadowed = ((Text, Module.Module), [Expr.Symbol]) Source #

Warnings for shadowed symbols. ((call_type, module), symbols)

compile :: Library -> (Builtins, [Shadowed]) Source #

Convert Library to Builtins. This indexes by module and also gives me a place to emit warnings about duplicate symbol names.