garepinoh-0.9.9.2.1: reverse prefix notation calculator and calculation library

Safe HaskellSafe-Inferred

Console.Garepinoh.Types

Synopsis

Documentation

type Result t = Either String (Stack t)Source

Result is either an error message or a Stack.

type Prelude t = [Func t]Source

A Prelude is a list of pre-defined functions.

type Stack t = [El t]Source

A Stack is (simulated by) a list of elements.

data El t Source

An element is either...

Constructors

Va t

a value of type t,

Li [El t]

a list of elements, or

Fu (Func t)

a function

Instances

Eq t => Eq (El t) 
Show t => Show (El t) 

data NonEmptyList t Source

NonEmptyList is a non-empty list.

Constructors

NEL 

Fields

hd :: t

first element (head) of the (non-empty) list.

tl :: [t]

remaining part (tail) of the (non-empty) list.

data Func t Source

A Function consists of:

Constructors

Func 

Fields

symb :: NonEmptyList String

a non-empty list of identifiers;

func :: [Function t]

a list ([f_fst,f_snd,..,f_last]) of primitive/undivisible Functions which are evaluated step-by-step.

Instances

Show (Func t) 

data Function t Source

A primitive/undivisible Function is one of:

Constructors

Ele (El t)

an element El;

Ref String

a reference to other functions; or

Fun (Prelude t -> Stack t -> Either String (Stack t))

an actual primitivepre-definedhard-coded function.