Karya, built on 2018-05-31T02:46:59 (patch 0a1a35479c514820d77330ae8a978975ba22a47a)

Safe HaskellNone

Ui.Id

Contents

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
Eq Id # 
Instance details

Defined in Ui.Id

Methods

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

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

Ord Id # 
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 #

Read.Read Id # 
Instance details

Defined in Ui.Id

Show Id # 
Instance details

Defined in Ui.Id

Methods

showsPrec :: Int -> Id -> ShowS #

show :: Id -> String #

showList :: [Id] -> ShowS #

DeepSeq.NFData Id # 
Instance details

Defined in Ui.Id

Methods

rnf :: Id -> () #

CRC32.CRC32 Id # 
Instance details

Defined in Ui.Id

Methods

crc32 :: Id -> Word32 #

crc32Update :: Word32 -> Id -> Word32 #

Pretty Id # 
Instance details

Defined in Ui.Id

Serialize.Serialize Id # 
Instance details

Defined in Ui.Id

Ident Id # 
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
Eq Namespace # 
Instance details

Defined in Ui.Id

Ord Namespace # 
Instance details

Defined in Ui.Id

Read.Read Namespace # 
Instance details

Defined in Ui.Id

Show Namespace # 
Instance details

Defined in Ui.Id

DeepSeq.NFData Namespace # 
Instance details

Defined in Ui.Id

Methods

rnf :: Namespace -> () #

CRC32.CRC32 Namespace # 
Instance details

Defined in Ui.Id

Pretty Namespace # 
Instance details

Defined in Ui.Id

Serialize.Serialize Namespace # 
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.

Minimal complete definition

unpack_id, constructor_name, make

Instances
Ident RulerId # 
Instance details

Defined in Ui.Id

Ident TrackId # 
Instance details

Defined in Ui.Id

Ident ViewId # 
Instance details

Defined in Ui.Id

Ident BlockId # 
Instance details

Defined in Ui.Id

Ident Id # 
Instance details

Defined in Ui.Id

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

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

SomethingId -> "ns/name"

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

SomethingId -> "name"

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
Eq BlockId # 
Instance details

Defined in Ui.Id

Methods

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

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

Ord BlockId # 
Instance details

Defined in Ui.Id

Read.Read BlockId # 
Instance details

Defined in Ui.Id

Show BlockId # 
Instance details

Defined in Ui.Id

DeepSeq.NFData BlockId # 
Instance details

Defined in Ui.Id

Methods

rnf :: BlockId -> () #

CRC32.CRC32 BlockId # 
Instance details

Defined in Ui.Id

Pretty BlockId # 
Instance details

Defined in Ui.Id

Serialize.Serialize BlockId # 
Instance details

Defined in Ui.Id

Ident BlockId # 
Instance details

Defined in Ui.Id

newtype ViewId Source #

Reference to a View, as per BlockId.

Constructors

ViewId Id 
Instances
Eq ViewId # 
Instance details

Defined in Ui.Id

Methods

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

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

Ord ViewId # 
Instance details

Defined in Ui.Id

Read.Read ViewId # 
Instance details

Defined in Ui.Id

Show ViewId # 
Instance details

Defined in Ui.Id

DeepSeq.NFData ViewId # 
Instance details

Defined in Ui.Id

Methods

rnf :: ViewId -> () #

CRC32.CRC32 ViewId # 
Instance details

Defined in Ui.Id

Pretty ViewId # 
Instance details

Defined in Ui.Id

Serialize.Serialize ViewId # 
Instance details

Defined in Ui.Id

Ident ViewId # 
Instance details

Defined in Ui.Id

newtype TrackId Source #

Constructors

TrackId Id 
Instances
Eq TrackId # 
Instance details

Defined in Ui.Id

Methods

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

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

Ord TrackId # 
Instance details

Defined in Ui.Id

Read.Read TrackId # 
Instance details

Defined in Ui.Id

Show TrackId # 
Instance details

Defined in Ui.Id

DeepSeq.NFData TrackId # 
Instance details

Defined in Ui.Id

Methods

rnf :: TrackId -> () #

CRC32.CRC32 TrackId # 
Instance details

Defined in Ui.Id

Pretty TrackId # 
Instance details

Defined in Ui.Id

Serialize.Serialize TrackId # 
Instance details

Defined in Ui.Id

Ident TrackId # 
Instance details

Defined in Ui.Id

newtype RulerId Source #

Constructors

RulerId Id 
Instances
Eq RulerId # 
Instance details

Defined in Ui.Id

Methods

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

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

Ord RulerId # 
Instance details

Defined in Ui.Id

Read.Read RulerId # 
Instance details

Defined in Ui.Id

Show RulerId # 
Instance details

Defined in Ui.Id

DeepSeq.NFData RulerId # 
Instance details

Defined in Ui.Id

Methods

rnf :: RulerId -> () #

CRC32.CRC32 RulerId # 
Instance details

Defined in Ui.Id

Pretty RulerId # 
Instance details

Defined in Ui.Id

Serialize.Serialize RulerId # 
Instance details

Defined in Ui.Id

Ident RulerId # 
Instance details

Defined in Ui.Id