bburdette / cellme / Cellme.Cellme

Cellme


type alias Cell id cs =
{ code : String
, prog : Result String (List (Schelme.EvalStep.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) -> Basics.Bool) -> CellContainer id cc -> Basics.Bool
, makeId : List (Schelme.EvalStep.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.


type FullEvalResult
    = FeOk
    | FeLoop
    | FeEvalError
    | FeCompileError

the possible outcomes of running all cell programs to completion.


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

possible results from a PSideEffectorFn


type alias PSideEffectorFn id cc =
Schelme.EvalStep.NameSpace (CellState id cc) -> CellState id cc -> List (Schelme.EvalStep.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 (Schelme.EvalStep.EvalBodyStep cs) id
    | RsErr String
    | RsUnevaled
    | RsOk (Schelme.EvalStep.Term cs)

the possible run states for a cell program.

cellVal : Schelme.EvalStep.NameSpace (CellState id cc) -> CellState id cc -> List (Schelme.EvalStep.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 : Schelme.EvalStep.NameSpace (CellState id cc)

the cell language is schelme plus 'cv'

compileCells : CellContainer id cc -> CellContainer id cc

compile all cell programs.

compileError : CellContainer id cc -> Basics.Bool

does any cell have a compile error?

continueCell : CellContainer id cc -> Cell id (CellState id cc) -> Cell id (CellState id cc)

continue running a cell program.

evalArgsPSideEffector : PSideEffectorFn id cc -> Schelme.EvalStep.SideEffector (CellState id cc)

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

evalCell : CellContainer id cc -> Cell id (CellState id cc) -> Cell id (CellState id cc)

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

evalCellsFully : CellContainer id cc -> ( CellContainer id cc, FullEvalResult )

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

evalCellsOnce : CellContainer id cc -> CellContainer id cc

eval all cells, resulting in an updated array.

runCell : CellContainer id cc -> Cell id (CellState id cc) -> Cell id (CellState id cc)

run a cell from its current state to completion.

runCellBody : Schelme.EvalStep.EvalBodyStep (CellState id cc) -> RunState id (CellState id cc)

run the cell program to completion