essence-of-live-coding-0.2.6: General purpose live coding framework
Safe HaskellSafe-Inferred
LanguageHaskell2010

LiveCoding.Migrate.Cell

Synopsis

Migrations to and from pairs

Generic migration functions

maybeMigrateToPair Source #

Arguments

:: (Typeable a, Typeable b, Typeable c) 
=> (t a b -> a)

The accessor of the first element

-> (t a b -> b)

The accessor of the second element

-> (a -> b -> t a b)

The constructor

-> t a b

The pair

-> c

The new value for the first or second element

-> Maybe (t a b) 

Builds the migration function for a pair, or product type, such as tuples, but customisable to your own products. You need to pass it the equivalents of fst, snd, and (,). Tries to migrate the value into the first element, then into the second.

maybeMigrateFromPair Source #

Arguments

:: (Typeable a, Typeable b, Typeable c) 
=> (t a b -> a)

The accessor of the first element

-> (t a b -> b)

The accessor of the second element

-> t a b 
-> Maybe c 

Like maybeMigrateToPair, but in the other direction. Again, it is biased with respect to the first element of the pair.

Migrations involving sequential compositions of cells

migrationToComposition :: Migration Source #

Migrate cell to cell >>> cell', and if this fails, to cell' >>> cell.

migrationFromComposition :: Migration Source #

Migrate cell1 >>> cell2 to cell1, and if this fails, to cell2.

migrationComposition :: Migration Source #

Combines all migrations related to composition, favouring migration to compositions.

Migrations involving parallel compositions of cells

migrationToParallel :: Migration Source #

Migrate cell to cell *** cell', and if this fails, to cell' *** cell.

migrationFromParallel :: Migration Source #

Migrate from cell1 *** cell2 to cell1, and if this fails, to cell2.

migrationParallel :: Migration Source #

Combines all migrations related to parallel composition, favouring migration to parallel composition.

Migration involving ArrowChoice

migrationToChoice :: Migration Source #

Migrate cell to cell ||| cell', and if this fails, to cell' ||| cell.

migrationFromChoice :: Migration Source #

Migrate from cell1 ||| cell2 to cell1, and if this fails, to cell2.

migrationChoice :: Migration Source #

Combines all migrations related to choice, favouring migration to choice.

Feedback

migrationToFeedback :: Migration Source #

Migrate from cell to feedback s cell, and if this fails, to feedback (cellState cell) cell'.

migrationFromFeedback :: Migration Source #

Migrate from feedback s cell to cell, and if this fails, to Cell { cellState = s, .. }.

migrationFeedback :: Migration Source #

Combines all migrations related to feedback, favouring migration to feedback.

Control flow

maybeMigrateToExceptState :: (Typeable state, Typeable state') => ExceptState state e -> state' -> Maybe (ExceptState state e) Source #

migrationToExceptState :: Migration Source #

Migration from cell2 to try cell1 >> safe cell2

maybeMigrateFromExceptState :: (Typeable state, Typeable state') => ExceptState state e -> Maybe state' Source #

migrationFromExceptState :: Migration Source #

Migration from try cell1 >> safe cell2 to cell2

migrationExceptState :: Migration Source #

Combines all control flow related migrations

Overall migration

migrationCell :: Migration Source #

Combines all Cell-related migrations.