Entries in italics are supertypes of existing types, for convenience.

Literals & Entities

== :: Entity -> Entity -> Boolean
Entity equality.

/= :: Entity -> Entity -> Boolean
Entity non-equality.

entityUUID :: Entity -> Text
UUID of an entity.

id :: Literal -> Entity
Every literal is an entity.

toText :: Literal -> Text
The text of a literal.

Boolean

id :: Boolean -> Literal
Every boolean is a literal.

True :: Boolean (also pattern)
Boolean TRUE.

False :: Boolean (also pattern)
Boolean FALSE.

&& :: Boolean -> Boolean -> Boolean
Boolean AND.

|| :: Boolean -> Boolean -> Boolean
Boolean OR.

not :: Boolean -> Boolean
Boolean NOT.

Text

id :: Text -> Literal
Every text is a literal.

<> :: Text -> Text -> Text
Concatenate text.

textLength :: Text -> Integer
The length of a piece of text.

textSection :: Integer -> Integer -> Text -> Text
textSection start len text is the section of text beginning at start of length len.

textConcat :: [Text] -> Text
Concatenate texts.

Numeric

~== :: Number -> Number -> Boolean
Numeric equality, folding exact and inexact numbers.

~/= :: Number -> Number -> Boolean
Numeric non-equality.

< :: Number -> Number -> Boolean
Numeric strictly less.

<= :: Number -> Number -> Boolean
Numeric less or equal.

> :: Number -> Number -> Boolean
Numeric strictly greater.

>= :: Number -> Number -> Boolean
Numeric greater or equal.

Integer

id :: Integer -> Rational
Every integer is a rational.

parseInteger :: Text -> Maybe Integer
Parse text as an integer.

interpretIntegerAsText :: Ref Integer -> Ref Text
Interpret an integer reference as text.

+ :: Integer -> Integer -> Integer
Add.

- :: Integer -> Integer -> Integer
Subtract.

* :: Integer -> Integer -> Integer
Multiply.

negate :: Integer -> Integer
Negate.

abs :: Integer -> Integer
Absolute value.

signum :: Integer -> Integer
Sign.

mod :: Integer -> Integer -> Integer
Modulus, leftover from div

even :: Integer -> Boolean
Is even?

odd :: Integer -> Boolean
Is odd?

gcd :: Integer -> Integer -> Integer
Greatest common divisor.

lcm :: Integer -> Integer -> Integer
Least common multiple.

^ :: Integer -> Integer -> Integer
Raise to non-negative power.

sum :: [Integer] -> Integer
Sum.

product :: [Integer] -> Integer
Product.

Rational

id :: Rational -> Number
Every rational is a number.

parseRational :: Text -> Maybe Rational
Parse text as a rational.

interpretRationalAsText :: Ref Rational -> Ref Text
Interpret a rational reference as text.

.+ :: Rational -> Rational -> Rational
Add.

.- :: Rational -> Rational -> Rational
Subtract.

.* :: Rational -> Rational -> Rational
Multiply.

/ :: Rational -> Rational -> Rational
Divide.

negateR :: Rational -> Rational
Negate.

recip :: Rational -> Rational
Reciprocal.

absR :: Rational -> Rational
Absolute value.

signumR :: Rational -> Rational
Sign.

modR :: Rational -> Rational -> Rational
Modulus, leftover from div

^^ :: Rational -> Integer -> Rational
Raise to Integer power.

sumR :: [Rational] -> Rational
Sum.

meanR :: [Rational] -> Rational
Mean.

productR :: [Rational] -> Rational
Product.

Number

id :: Number -> Literal
Every number is a literal.

parseNumber :: Text -> Maybe Number
Parse text as a number.

interpretNumberAsText :: Ref Number -> Ref Text
Interpret a number reference as text.

~+ :: Number -> Number -> Number
Add.

~- :: Number -> Number -> Number
Subtract.

~* :: Number -> Number -> Number
Multiply.

~/ :: Number -> Number -> Number
Divide.

negateN :: Number -> Number
Negate.

recipN :: Number -> Number
Reciprocal.

pi :: Number
Half the radians in a circle.

exp :: Number -> Number
Exponent

log :: Number -> Number
Natural logarithm

sqrt :: Number -> Number
Square root.

** :: Number -> Number -> Number
Raise to power.

logBase :: Number -> Number -> Number

sin :: Number -> Number
Sine of an angle in radians.

cos :: Number -> Number
Cosine of an angle in radians.

tan :: Number -> Number
Tangent of an angle in radians.

asin :: Number -> Number
Radian angle of a sine.

acos :: Number -> Number
Radian angle of a cosine.

atan :: Number -> Number
Radian angle of a tangent.

sinh :: Number -> Number
Hyperbolic sine.

cosh :: Number -> Number
Hyperbolic cosine.

tanh :: Number -> Number
Hyperbolic tangent.

asinh :: Number -> Number
Inverse hyperbolic sine.

acosh :: Number -> Number
Inverse hyperbolic cosine.

atanh :: Number -> Number
Inverse hyperbolic tangent.

nabs :: Number -> Number
Absolute value.

signumN :: Number -> Number
Sign. Note this will be the same exact or inexact as the number.

floor :: Number -> Integer
Integer towards negative infinity.

ceiling :: Number -> Integer
Integer towards positive infinity.

round :: Number -> Integer
Closest Integer.

inexact :: Number -> Number
Convert a number to inexact.

approximate :: Rational -> Number -> Rational
approximate d x gives the exact number that's a multiple of d that's closest to x.

div :: Number -> Number -> Integer
Division to Integer, towards negative infinity.

modN :: Number -> Number -> Number
Modulus, leftover from div

isNaN :: Number -> Boolean
Is not a number?

isInfinite :: Number -> Boolean
Is infinite?

isNegativeZero :: Number -> Boolean
Is negative zero?

isExact :: Number -> Boolean
Is exact?

sumN :: [Number] -> Number
Sum.

meanN :: [Number] -> Number
Mean.

productN :: [Number] -> Number
Product.

checkExactRational :: Number -> Maybe Rational
Get the exact value of a Number, if it is one.

checkExactInteger :: Number -> Maybe Integer
Get the exact Integer value of a Number, if it is one. Works as expected on Rationals.

Date & Time

Duration

id :: Duration -> Literal
Every duration is a literal.

parseDuration :: Text -> Maybe Duration
Parse text as a duration.

interpretDurationAsText :: Ref Duration -> Ref Text
Interpret a duration reference as text.

zeroDuration :: Duration
No duration.

secondsToDuration :: Rational -> Duration
Convert seconds to duration.

durationToSeconds :: Duration -> Rational
Convert duration to seconds.

dayDuration :: Duration
One day duration.

addDuration :: Duration -> Duration -> Duration
Add durations.

subtractDuration :: Duration -> Duration -> Duration
Subtract durations.

negateDuration :: Duration -> Duration
Negate duration.

multiplyDuration :: Number -> Duration -> Duration
Multiply a duration by a number.

divideDuration :: Duration -> Duration -> Number
Divide durations.

Time

Absolute time as measured by UTC.

id :: Time -> Literal
Every time is a literal.

parseTime :: Text -> Maybe Time
Parse text as a time.

interpretTimeAsText :: Ref Time -> Ref Text
Interpret a time reference as text.

addTime :: Duration -> Time -> Time
Add duration to time.

diffTime :: Time -> Time -> Duration
Difference of times.

now :: Ref +Time
The current time truncated to the second.

Calendar

Day :: Integer -> Integer -> Integer -> Day (also pattern)
Construct a Day from year, month, day.

id :: Day -> Literal
Every day is a literal.

parseDay :: Text -> Maybe Day
Parse text as a day.

interpretDayAsText :: Ref Day -> Ref Text
Interpret a day reference as text.

dayToModifiedJulian :: Day -> Integer
Convert to MJD.

modifiedJulianToDay :: Integer -> Day
Convert from MJD.

addDays :: Integer -> Day -> Day
Add count to days.

diffDays :: Day -> Day -> Integer
Difference of days.

utcDay :: Ref +Day
The current UTC day.

today :: Ref +Day
The current local day.

Time of Day

TimeOfDay :: Integer -> Integer -> Rational -> TimeOfDay (also pattern)
Construct a TimeOfDay from hour, minute, second.

id :: TimeOfDay -> Literal
Every time of day is a literal.

parseTimeOfDay :: Text -> Maybe TimeOfDay
Parse text as a time of day.

interpretTimeOfDayAsText :: Ref TimeOfDay -> Ref Text
Interpret a time of day reference as text.

midnight :: TimeOfDay
Midnight.

midday :: TimeOfDay
Midday.

Local Time

LocalTime :: Day -> TimeOfDay -> LocalTime (also pattern)
Construct a LocalTime from day and time of day.

id :: LocalTime -> Literal
Every local time is a literal.

parseLocalTime :: Text -> Maybe LocalTime
Parse text as a local time.

interpretLocalTimeAsText :: Ref LocalTime -> Ref Text
Interpret a local time reference as text.

timeToLocal :: Integer -> Time -> LocalTime
Convert a time to local time, given a time zone offset in minutes

localToTime :: Integer -> LocalTime -> Time
Convert a local time to time, given a time zone offset in minutes

getTimeZone :: Time -> Action Integer
Get the offset for a time in the current time zone.

timeZone :: Ref +Integer
The current time zone offset in minutes.

localNow :: Ref +LocalTime
The current local time.

Maybe

Just :: a -> Maybe a (also pattern)
Construct a Maybe from a value.

Nothing :: Maybe None (also pattern)
Construct a Maybe without a value.

id :: Maybe Entity -> Entity
Entity conversion.

Pairs

id :: (Entity, Entity) -> Entity
Entity conversion.

fst :: (a, b) -> a
Get the first member of a pair.

snd :: (a, b) -> b
Get the second member of a pair.

toPair :: a -> b -> (a, b)
Construct a pair.

pair :: a -> (a, a)
Construct a pair.

Either

Left :: a -> Either a b (also pattern)
Construct an Either from the left.

Right :: b -> Either a b (also pattern)
Construct an Either from the right.

id :: Either Entity Entity -> Entity
Entity conversion.

fromEither :: (a -> c) -> (b -> c) -> Either a b -> c
Eliminate an Either

either :: Either a a -> a
Eliminate an Either

Lists

[] :: [None] (also pattern)
Empty list

: :: a -> [a] -> [a] (also pattern)
Construct a list

id :: [Entity] -> Entity
Entity conversion.

list :: b -> (a -> [a] -> b) -> [a] -> b
Eliminate a list

length :: [Any] -> Integer
Number of items in a list

mapList :: (a -> b) -> [a] -> [b]
Map the items of a list.

++ :: [a] -> [a] -> [a]
Concatentate lists.

filter :: (a -> Boolean) -> [a] -> [a]
Filter a list.

maybeMapList :: (a -> Maybe b) -> [a] -> [b]
Map and filter a list.

take :: Integer -> [a] -> [a]
Take the first n elements.

drop :: Integer -> [a] -> [a]
Drop the first n elements.

zip :: [a] -> [b] -> [(a, b)]
Zip two lists.

Functions

id :: a -> a
The identity function.

$ :: (a -> b) -> a -> b
Apply a function to a value.

. :: (a -> b) -> (c -> a) -> c -> b
Compose functions.

error :: Text -> None
Error.

Actions

return :: a -> Action a
A value as an Action.

>>= :: Action a -> (a -> Action b) -> Action b
Bind the result of an Action to an Action.

>> :: Action Any -> Action a -> Action a
Do actions in sequence.

fixAction :: (a -> Action a) -> Action a
The fixed point of an Action.

fail :: Text -> Action None
Fail, causing the program to terminate with error.

stop :: Action None
Stop. This is similar to an exception that can be caught with onStop. The default handler (for the main program, button presses, etc.), is to catch and ignore it.

onStop :: Action a -> Action a -> Action a
onStop p q does p first, and if it stops, then does q.

for_ :: [a] -> (a -> Action ()) -> Action ()
Perform an action on each value of a list.

for :: [a] -> (a -> Action b) -> Action [b]
Perform an action on each value of a list, returning a list.

output :: Text -> Action ()
Output text to standard output.

outputLn :: Text -> Action ()
Output text and a newline to standard output.

getTimeMS :: Action Integer
Get the time as a whole number of milliseconds.

Undo

Undo and redo changes.

queueUndo :: Action Boolean
Undo an action.

queueRedo :: Action Boolean
Redo an action.

References

A reference of type Ref {-p,+q} has a setting type of p and a getting type of q. References keep track of updates, and will update user interfaces constructed from them when their value changes.

pureRef :: a -> Ref +a
A constant reference for a value.

immutRef :: Ref +a -> Ref +a
Convert a reference to immutable. immutRef r = {%r}

coMapRef :: (a -> b) -> Ref {-c,+a} -> Ref {-c,+b}
Map a function on getting a reference.

contraMapRef :: (b -> a) -> Ref {-a,+c} -> Ref {-b,+c}
Map a function on setting a reference.

lensMapRef :: (aq -> b) -> (b -> aq -> Maybe ap) -> Ref {-ap,+aq} -> Ref b
Map getter & pushback functions on a reference.

applyRef :: Ref +(a -> b) -> Ref +a -> Ref +b
Combine references.

unknown :: Ref {}
The unknown reference, representing missing information.

known :: Ref {} -> Ref +Boolean
True if the reference is known.

?? :: Ref +a -> Ref +a -> Ref +a
p ?? q = p if it is known, else q.

get :: Ref +a -> Action a
Get a reference, or stop if the reference is unknown.

runRef :: Ref +(Action ()) -> Action ()
Run an action from a reference.

:= :: Ref -a -> a -> Action ()
Set a reference to a value. Stop if failed.

delete :: Ref {} -> Action ()
Delete an entity reference. Stop if failed.

newMemRef :: Action (Ref a)
Create a new reference to memory, initially unknown.

Set References

mapSet :: (a -> b) -> SetRef b -> SetRef a
Map a function on a set.

pureSet :: (a -> Boolean) -> SetRef (Entity & a)
Convert a predicate to a set.

refSet :: Ref {-((Entity & a) -> Boolean),+(a -> Boolean)} -> SetRef (Entity & a)
Convert a predicate reference to a set.

immutSet :: SetRef a -> SetRef a
Convert a set to immutable.

+= :: SetRef a -> a -> Action ()
Add an entity to a set.

-= :: SetRef a -> a -> Action ()
Remove an entity from a set.

newEntity :: SetRef NewEntity -> Action NewEntity
Create a new entity in a set and act on it.

member :: SetRef a -> Ref +a -> Ref Boolean
A reference to the membership of a value in a set.

notSet :: SetRef a -> SetRef a
Complement of a set. The resulting set can be added to (deleting from the original set) and deleted from (adding to the original set).

<&> :: SetRef a -> SetRef a -> SetRef a
Intersection of sets. The resulting set can be added to (adding to both sets), but not deleted from.

<|> :: SetRef a -> SetRef a -> SetRef a
Union of sets. The resulting set can be deleted from (deleting from both sets), but not added to.

<\> :: SetRef a -> SetRef a -> SetRef a
Difference of sets, everything in the first set but not the second. The resulting set can be added to (adding to the first and deleting from the second), but not deleted from.

<^> :: SetRef a -> SetRef a -> SetRef a
Symmetric difference of sets, everything in exactly one of the sets. The resulting set will be read-only.

<+> :: SetRef a -> SetRef b -> SetRef (Either a b)
Cartesian sum of sets.

<*> :: SetRef a -> SetRef b -> SetRef (a, b)
Cartesian product of sets. The resulting set will be read-only.

Finite Set References

id :: FiniteSetRef -a -> SetRef a
Every finite set is a set.

coMapFiniteSet :: (a -> b) -> FiniteSetRef {-c,+a} -> FiniteSetRef {-c,+b}
Map a function on getting from a finite set.

contraMapFiniteSet :: (b -> a) -> FiniteSetRef {-a,+c} -> FiniteSetRef {-b,+c}
Map a function on setting to and testing a finite set.

<:&> :: FiniteSetRef {-a,+b} -> SetRef b -> FiniteSetRef {-a,+b}
Intersect a finite set with any set. The resulting finite set will be read-only.

<:\> :: FiniteSetRef {-a,+b} -> SetRef b -> FiniteSetRef {-a,+b}
Difference of a finite set and any set. The resulting finite set will be read-only.

<:&:> :: FiniteSetRef {a,+Entity} -> FiniteSetRef {a,+Entity} -> FiniteSetRef {a,-Entity}
Intersection of finite sets. The resulting finite set can be added to, but not deleted from.

<:|:> :: FiniteSetRef {a,+Entity} -> FiniteSetRef {a,+Entity} -> FiniteSetRef {a,-Entity}
Union of finite sets. The resulting finite set can be deleted from, but not added to.

<:+:> :: FiniteSetRef {-ap,+aq} -> FiniteSetRef {-bp,+bq} -> FiniteSetRef {-(Either ap bp),+(Either aq bq)}
Cartesian sum of finite sets.

<:+:> :: FiniteSetRef a -> FiniteSetRef b -> FiniteSetRef (Either a b)
Cartesian sum of finite sets.

<:*:> :: FiniteSetRef {-ap,+aq} -> FiniteSetRef {-bp,+bq} -> FiniteSetRef {-(ap, bp),+(aq, bq)}
Cartesian product of finite sets. The resulting finite set will be read-only.

<:*:> :: FiniteSetRef a -> FiniteSetRef b -> FiniteSetRef (a, b)
Cartesian product of finite sets. The resulting finite set will be read-only.

members :: Order a -> FiniteSetRef +a -> Ref +[a]
Get all members of a finite set, by an order.

single :: FiniteSetRef {+Entity,+a} -> Ref +a
The member of a single-member finite set, or unknown.

count :: FiniteSetRef {} -> Ref +Integer
Count of members in a finite set.

removeAll :: FiniteSetRef {} -> Action ()
Remove all entities from a finite set.

newMemFiniteSet :: Action (FiniteSetRef {a,-Entity})
Create a new finite set reference to memory, initially empty.

Morphisms

Morphisms relate entities.

identity :: {a,-Entity} ~> {a,-Entity}
The identity morphism.

!. :: ({-bq,+bp} ~> {-cp,+cq}) -> ({-aq,+ap} ~> {-bp,+bq}) -> {-aq,+ap} ~> {-cp,+cq}
Compose morphisms.

!. :: (b ~> c) -> (a ~> b) -> a ~> c
Compose morphisms.

!** :: ({-ap,+aq} ~> {-bp,+bq}) -> ({-aq,+ap} ~> {-cp,+cq}) -> {-ap,+aq} ~> {-(bp, cp),+(bq, cq)}
Pair morphisms. References from these morphisms are undeleteable.

!** :: (a ~> b) -> (a ~> c) -> a ~> (b, c)
Pair morphisms. References from these morphisms are undeleteable.

!++ :: ({-ap,+aq} ~> {-cp,+cq}) -> ({-bp,+bq} ~> {-cq,+cp}) -> {-(Either ap bp),+(Either aq bq)} ~> {-cp,+cq}
Either morphisms. References from these morphisms are undeleteable.

!++ :: (a ~> c) -> (b ~> c) -> (Either a b) ~> c
Either morphisms. References from these morphisms are undeleteable.

!$ :: ({-aq,+ap} ~> {-bp,+bq}) -> Ref {-ap,+aq} -> Ref {-bp,+bq}
Apply a morphism to a reference.

!$ :: (a ~> b) -> Ref a -> Ref b
Apply a morphism to a reference.

!$% :: (-a ~> {-bp,+bq}) -> Ref +a -> Ref {-bp,+bq}
Apply a morphism to an immutable reference. m !$% r = m !$ immutRef r

!$% :: (-a ~> b) -> Ref +a -> Ref b
Apply a morphism to an immutable reference. m !$% r = m !$ immutRef r

!$$ :: (-a ~> {-bp,+bq}) -> FiniteSetRef +a -> FiniteSetRef {-bp,+bq}
Apply a morphism to a set.

!$$ :: (-a ~> b) -> FiniteSetRef +a -> FiniteSetRef b
Apply a morphism to a set.

!@ :: ({-bp,+bq} ~> {-aq,+ap}) -> Ref {-ap,+aq} -> FiniteSetRef {-bp,+bq}
Co-apply a morphism to a reference.

!@ :: (b ~> a) -> Ref a -> FiniteSetRef b
Co-apply a morphism to a reference.

!@% :: ({-bp,+bq} ~> -a) -> Ref +a -> FiniteSetRef {-bp,+bq}
Co-apply a morphism to an immutable reference. m !@% r = m !@ immutRef r

!@% :: (b ~> -a) -> Ref +a -> FiniteSetRef b
Co-apply a morphism to a reference. m !@% r = m !@ immutRef r

!@@ :: ({-bp,+bq} ~> {-NewEntity,-aq,+ap}) -> FiniteSetRef {-ap,+aq} -> FiniteSetRef {-bp,+bq}
Co-apply a morphism to a set.

!@@ :: (b ~> {a,-NewEntity}) -> FiniteSetRef a -> FiniteSetRef b
Co-apply a morphism to a set.

Orders

alphabetical :: Order Text
Alphabetical order.

numerical :: Order Number
Numercal order.

chronological :: Order Time
Chronological order.

durational :: Order Duration
Durational order.

calendrical :: Order Day
Day order.

horological :: Order TimeOfDay
Time of day order.

localChronological :: Order LocalTime
Local time order.

noOrder :: Order Any
No order, same as orders [].

orders :: [Order a] -> Order a
Join orders by priority.

mapOrder :: (b -> a) -> Order a -> Order b
Map a function on an order.

orderOn :: (-b ~> +a) -> Order a -> Order b
Order by an order on a particular morphism.

rev :: Order a -> Order a
Reverse an order.

orderEQ :: Order a -> Ref +a -> Ref +a -> Ref +Boolean
Equal by an order.

orderLT :: Order a -> Ref +a -> Ref +a -> Ref +Boolean
Less than by an order.

orderLE :: Order a -> Ref +a -> Ref +a -> Ref +Boolean
Less than or equal to by an order.

orderGT :: Order a -> Ref +a -> Ref +a -> Ref +Boolean
Greater than by an order.

orderGE :: Order a -> Ref +a -> Ref +a -> Ref +Boolean
Greater than or equal to by an order.

UI

A user interface is something that goes inside a window.

uiWithSelection :: (Action a -> UI a) -> UI a
User interface with selection.

uiMap :: (a -> b) -> UI a -> UI b
Map user interface selection

uiIgnore :: UI Any -> UI None
Ignore user interface selection

uiBlank :: UI None
Blank user-interface

uiUnitCheckBox :: Ref +Text -> Ref () -> UI None
(TBD)

uiCheckBox :: Ref +Text -> Ref Boolean -> UI None
Checkbox. Use shift-click to set to unknown.

uiTextEntry :: Ref Text -> UI None
Text entry, unknown reference will be interpreted as empty text, but the UI will not delete the reference.

uiTextArea :: Ref Text -> UI None
Text area, unknown reference will be interpreted as empty text, but the UI will not delete the reference.

uiLabel :: Ref +Text -> UI None
Label.

uiHorizontal :: [(UI a, Boolean)] -> UI a
Items arranged horizontally, each flag is whether to expand into remaining space.

uiVertical :: [(UI a, Boolean)] -> UI a
Items arranged vertically, each flag is whether to expand into remaining space.

uiPages :: [(UI Any, UI a)] -> UI a
A notebook of pages. First of each pair is for the page tab (typically a label), second is the content.

uiButton :: Ref +Text -> Ref +(Action Any) -> UI None
A button with this text that does this action. Button will be disabled if the action reference is unknown.

uiPick :: (-a ~> +Text) -> FiniteSetRef {a,+Entity} -> Ref {a,+Entity} -> UI None
A drop-down menu.

uiTable :: [(Ref +Text, a -> Ref +Text)] -> Order a -> FiniteSetRef {a,+Entity} -> (a -> Action Any) -> UI a
A list table. First arg is columns (name, property), second is order, third is the set of items, fourth is the window to open for a selection.

uiCalendar :: Ref Day -> UI None
A calendar.

uiScrolled :: UI a -> UI a
A scrollable container.

uiDynamic :: Ref +(UI a) -> UI a
A UI that can be updated to different UIs.

Menu items.

menuSeparator :: MenuItem
Separator menu item.

menuSubmenu :: Text -> [MenuItem] -> MenuItem
Submenu menu item.

menuAction :: Text -> Maybe Text -> Ref +(Action Any) -> MenuItem
Action menu item. Item will be disabled if the action reference is unknown.

Window

User interface windows.

openWindow :: Ref +Text -> (Action a -> Ref +[MenuItem]) -> UI a -> Action Window
Open a new window with this title and UI.

closeWindow :: Window -> Action ()
Close a window.

exitUI :: Action ()
Exit the user interface.

Files

NYI