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

Ui.Id

Synopsis

Documentation

data Id Source #

IDs come in two parts, a namespace and a name.

This is so so that you can merge two scores together and not have their IDs clash. Since block calls within a score will generally leave the namespace implicit, the merged score should still be playable.

Instances

Instances details
FromJSON Id Source # 
Instance details

Defined in Ui.Id

ToJSON Id Source # 
Instance details

Defined in Ui.Id

Show Id Source # 
Instance details

Defined in Ui.Id

Methods

showsPrec :: Int -> Id -> ShowS #

show :: Id -> String #

showList :: [Id] -> ShowS #

DeepSeq.NFData Id Source # 
Instance details

Defined in Ui.Id

Methods

rnf :: Id -> () #

Eq Id Source # 
Instance details

Defined in Ui.Id

Methods

(==) :: Id -> Id -> Bool #

(/=) :: Id -> Id -> Bool #

Ord Id Source # 
Instance details

Defined in Ui.Id

Methods

compare :: Id -> Id -> Ordering #

(<) :: Id -> Id -> Bool #

(<=) :: Id -> Id -> Bool #

(>) :: Id -> Id -> Bool #

(>=) :: Id -> Id -> Bool #

max :: Id -> Id -> Id #

min :: Id -> Id -> Id #

Ident Id Source # 
Instance details

Defined in Ui.Id

Pretty Id Source # 
Instance details

Defined in Ui.Id

Seed.Seed Id Source # 
Instance details

Defined in Ui.Id

Methods

to_seed :: Int -> Id -> Int Source #

Serialize.Serialize Id Source # 
Instance details

Defined in Ui.Id

data Namespace Source #

The Namespace should pass valid_symbol, and is guaranteed to not contain /s. This is because the git backend uses the namespace for a directory name.

Instances

Instances details
Read.Read Namespace Source # 
Instance details

Defined in Ui.Id

Show Namespace Source # 
Instance details

Defined in Ui.Id

DeepSeq.NFData Namespace Source # 
Instance details

Defined in Ui.Id

Methods

rnf :: Namespace -> () #

Eq Namespace Source # 
Instance details

Defined in Ui.Id

Ord Namespace Source # 
Instance details

Defined in Ui.Id

Pretty Namespace Source # 
Instance details

Defined in Ui.Id

Seed.Seed Namespace Source # 
Instance details

Defined in Ui.Id

Methods

to_seed :: Int -> Namespace -> Int Source #

Serialize.Serialize Namespace Source # 
Instance details

Defined in Ui.Id

access

modify_name :: (Text -> Text) -> Id -> Id Source #

read / show

read_short :: Namespace -> Text -> Id Source #

A smarter constructor that only applies the namespace if the string doesn't already have one.

show_short :: Namespace -> Id -> Text Source #

The inverse of read_short.

validate

valid_symbol :: Text -> Bool Source #

True if this Namespace or Id name follows some strict rules, which are a superset of the rules that make it parseable as an unquoted symbol.

A valid identifier is [a-z][a-z0-9.-]*, as in symbol_description. Hyphens are intended to separate words, and dots intended to separate syntactic elements, whatever those may be. The rules are intentionally restrictive, to force standardization on names, and also to keep some syntactic flexibility in case I want to add special syntax.

I originally used dots for relative calls, but they turn out to be annoying because you can't start a tracklang symbol with one, so now they use a hyphen. Dots are still used for divisions in automatically generated names, for instance, TrackIds are generated as block.t1.

Several kinds of tracklang names use this definition of validity, not just Ids (e.g. instrument or control names). It's easier to remember a single rule for a valid name rather than each syntactic form have its own rules.

symbol_description :: Text Source #

Describe a valid identifier for docs and error messages.

is_id_char :: Char -> Bool Source #

This defines the set of valid characters allowed in an ID.

Ident

class Ident a where Source #

BlockIds, RulerIds, etc. are just wrappers around Ids. Giving them a consistent display format lets me copy and paste them on the repl socket, which puts the constructors in scope.

show_ident :: forall a. Ident a => a -> String Source #

ident_text :: Ident a => a -> Text Source #

SomethingId -> "ns/name"

text_ident :: Ident a => Text -> Maybe a Source #

"ns/name" -> SomethingId

ident_name :: Ident a => a -> Text Source #

SomethingId -> "name"

modify :: Ident a => (Id -> Id) -> a -> a Source #

constants

instances

newtype BlockId Source #

Reference to a Block. Use this to look up Blocks in the State.

The convention is that BlockId should name a block which is expected to exist, and the only way to create a BlockId is via create_block. The name of a block which is to be created is simply Id.

However, since the constructor is exported, this isn't rigorously enforced.

Unlike other Ids, block names have no restrictions, except no spaces. This is because they become note calls, and it's convenient to have arbitrary names for the same reason it's convenient to allow arbitrary characters in call names.

Constructors

BlockId Id 

Instances

Instances details
FromJSON BlockId Source # 
Instance details

Defined in Ui.Id

ToJSON BlockId Source # 
Instance details

Defined in Ui.Id

Read.Read BlockId Source # 
Instance details

Defined in Ui.Id

Show BlockId Source # 
Instance details

Defined in Ui.Id

DeepSeq.NFData BlockId Source # 
Instance details

Defined in Ui.Id

Methods

rnf :: BlockId -> () #

Eq BlockId Source # 
Instance details

Defined in Ui.Id

Methods

(==) :: BlockId -> BlockId -> Bool #

(/=) :: BlockId -> BlockId -> Bool #

Ord BlockId Source # 
Instance details

Defined in Ui.Id

Ident BlockId Source # 
Instance details

Defined in Ui.Id

Pretty BlockId Source # 
Instance details

Defined in Ui.Id

Seed.Seed BlockId Source # 
Instance details

Defined in Ui.Id

Methods

to_seed :: Int -> BlockId -> Int Source #

Serialize.Serialize BlockId Source # 
Instance details

Defined in Ui.Id

newtype ViewId Source #

Reference to a View, as per BlockId.

Constructors

ViewId Id 

Instances

Instances details
FromJSON ViewId Source # 
Instance details

Defined in Ui.Id

ToJSON ViewId Source # 
Instance details

Defined in Ui.Id

Read.Read ViewId Source # 
Instance details

Defined in Ui.Id

Show ViewId Source # 
Instance details

Defined in Ui.Id

DeepSeq.NFData ViewId Source # 
Instance details

Defined in Ui.Id

Methods

rnf :: ViewId -> () #

Eq ViewId Source # 
Instance details

Defined in Ui.Id

Methods

(==) :: ViewId -> ViewId -> Bool #

(/=) :: ViewId -> ViewId -> Bool #

Ord ViewId Source # 
Instance details

Defined in Ui.Id

Ident ViewId Source # 
Instance details

Defined in Ui.Id

Pretty ViewId Source # 
Instance details

Defined in Ui.Id

Serialize.Serialize ViewId Source # 
Instance details

Defined in Ui.Id

newtype TrackId Source #

Constructors

TrackId Id 

Instances

Instances details
FromJSON TrackId Source # 
Instance details

Defined in Ui.Id

ToJSON TrackId Source # 
Instance details

Defined in Ui.Id

Read.Read TrackId Source # 
Instance details

Defined in Ui.Id

Show TrackId Source # 
Instance details

Defined in Ui.Id

DeepSeq.NFData TrackId Source # 
Instance details

Defined in Ui.Id

Methods

rnf :: TrackId -> () #

Eq TrackId Source # 
Instance details

Defined in Ui.Id

Methods

(==) :: TrackId -> TrackId -> Bool #

(/=) :: TrackId -> TrackId -> Bool #

Ord TrackId Source # 
Instance details

Defined in Ui.Id

Ident TrackId Source # 
Instance details

Defined in Ui.Id

Pretty TrackId Source # 
Instance details

Defined in Ui.Id

Seed.Seed TrackId Source # 
Instance details

Defined in Ui.Id

Methods

to_seed :: Int -> TrackId -> Int Source #

Serialize.Serialize TrackId Source # 
Instance details

Defined in Ui.Id

newtype RulerId Source #

Constructors

RulerId Id 

Instances

Instances details
FromJSON RulerId Source # 
Instance details

Defined in Ui.Id

ToJSON RulerId Source # 
Instance details

Defined in Ui.Id

Read.Read RulerId Source # 
Instance details

Defined in Ui.Id

Show RulerId Source # 
Instance details

Defined in Ui.Id

DeepSeq.NFData RulerId Source # 
Instance details

Defined in Ui.Id

Methods

rnf :: RulerId -> () #

Eq RulerId Source # 
Instance details

Defined in Ui.Id

Methods

(==) :: RulerId -> RulerId -> Bool #

(/=) :: RulerId -> RulerId -> Bool #

Ord RulerId Source # 
Instance details

Defined in Ui.Id

Ident RulerId Source # 
Instance details

Defined in Ui.Id

Pretty RulerId Source # 
Instance details

Defined in Ui.Id

Serialize.Serialize RulerId Source # 
Instance details

Defined in Ui.Id