essence-of-live-coding-0.2.4: General purpose live coding framework

LiveCoding.Migrate.Cell

Synopsis

# Migrations to and from pairs

## Generic migration functions

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.

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

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

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

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

## Migrations involving parallel compositions of cells

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

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

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

## Migration involving ArrowChoice

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

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

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

## Feedback

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

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

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 #

Migration from cell2 to try cell1 >> safe cell2

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

Migration from try cell1 >> safe cell2 to cell2

Combines all control flow related migrations

# Overall migration

Combines all Cell-related migrations.