bburdette/cellme/1.0.0

Cellme.Cellme

Cellme

type alias Cell id cs =
{ code : String
, prog : Result String (List (Term cs))
, runstate : RunState id cs
}

a cell is a text-form schelme program, the compiled version of same, and the program's RunState.

type alias CcRecord id cc =
{ getCell :
id -> CellContainer id cc -> Maybe (Cell id (CellState id cc))
, setCell :
id
-> Cell id (CellState id cc)
-> CellContainer id cc
-> Result String (CellContainer id cc)
, map :
(Cell id (CellState id cc) -> Cell id (CellState id cc))
-> CellContainer id cc
-> CellContainer id cc
, has :
(Cell id (CellState id cc) -> Bool) -> CellContainer id cc -> Bool
, makeId : List (Term (CellState id cc)) -> Result String id
, showId : id -> String
, cells : cc
}

The record type for CellContainer - a CcRecord should contain an id type, a container type 'cc', and implementations of all these functions.

type CellContainer id cc
= CellContainer (CcRecord id cc)

a type that contains a CcRecord.

type CellState id cc
= CellState
{ cells : CellContainer id cc
, cellstatus : CellStatus id
}

when a cell program runs, it has access to CellState, the state of all cells.

type CellStatus id
= AllGood
| Blocked id

cell status may indicate that a cell is blocked because of another cell that needs to finish its program.

= FeOk
| FeLoop
| FeEvalError
| FeCompileError

the possible outcomes of running all cell programs to completion.

type PRes id cc
= PrOk
( NameSpace (CellState id cc)
, CellState id cc
, Term (CellState id cc)
)
| PrPause (CellState id cc)
| PrErr String

possible results from a PSideEffectorFn

type alias PSideEffectorFn id cc =
NameSpace (CellState id cc)
-> CellState id cc
-> List (Term (CellState id cc))
-> PRes id cc

The type signature of side effector functions in our cellme language. For now there's only one, 'cv'.

type RunState id cs
= RsBlocked (EvalBodyStep cs) id
| RsErr String
| RsUnevaled
| RsOk (Term cs)

the possible run states for a cell program.

NameSpace (CellState id cc)
-> CellState id cc
-> List (Term (CellState id cc))
-> PRes id cc

the 'cv' function in our schelme script language. given a cell id, attempt to get the value of that cell from the CellState.

cellme : NameSpace (CellState id cc)

the cell language is schelme plus 'cv'

compile all cell programs.

compileError : CellContainer id cc -> Bool

does any cell have a compile error?

-> Cell id (CellState id cc)
-> Cell id (CellState id cc)

continue running a cell program.

evalArgsPSideEffector : PSideEffectorFn id cc -> SideEffector (CellState id cc)

just like the regular evalArgsSideEffector, except checks for PrPause from the fn.

-> Cell id (CellState id cc)
-> Cell id (CellState id cc)

reset the cell program, then run to completion (or blockage, anyway)

should eval all cells from the start, resulting in an updated array and result type.

eval all cells, resulting in an updated array.

-> Cell id (CellState id cc)
-> Cell id (CellState id cc)

run a cell from its current state to completion.

runCellBody : EvalBodyStep (CellState id cc) -> RunState id (CellState id cc)

run the cell program to completion