jxxcarlson/elm-spreadsheet/3.1.0

Cell

Cell specifies the kind content of Spreadsheet cells may have.

Types

type alias Cell =
Either Formula Value

Parse the text representation to see the internal representation of a cell:

> parse "3.1"
Right (Real 3.1)
type Formula
= Formula Op Operands

Examples:

Parse the text representation to see the internal representation of a formula:

> parse "=A2+B3"
Left (Formula Add (Pair { left = { col = 1, row = 0 }, right = { col = 2, row = 1 } }))


> parse "=sum(A2:A8)"
Left (Formula Add (Range { left = { col = 1, row = 0 }, right = { col = 7, row = 0 } }))


> parse "=sum(B3:B9)"
Left (Formula Add (Range { left = { col = 2, row = 1 }, right = { col = 8, row = 1 } }))
type Value
= Integer Int
| Real Float
| Boolean Bool
| String String
| Undefined
type alias Index =
{ row : Int
, col : Int
}
type Op
= NoOp
| Add
| Sub
| Mul
| Div
= Pair RawOperands
| Range RawOperands
type alias RawOperands =
{ left : Index
, right : Index
}

Functions

render : Cell -> String
isValue : Cell -> Bool
mapReal : (Float -> Float) -> Cell -> Cell
opFromString : String -> Op
opFromString2 : String -> Op
realValue : Cell -> Maybe Float
stringFromOp : Op -> String