Prelude
The Prelude is automatically imported unqualified into every other Prospero module. It provides the core functionality of the language.
Types
data List a
= Nil
| Cons { head : a, tail : List a }
Instances
data Precision
= Precision (Int)
Instances
instance ToStringFormat Decimal<'m> Precision
data WithoutUnit
= WithoutUnit
Instances
instance ToStringFormat Decimal<'m> WithoutUnitinstance ToStringFormat Integer<'m> WithoutUnit
data PrecisionWithoutUnit
= PrecisionWithoutUnit (Int)
Instances
instance ToStringFormat Decimal<'m> PrecisionWithoutUnit
data Option a
= None
| Some (a)
Instances
data Json
= JNull
| JBool Bool
| JNumber (Decimal<1>)
| JString String
| JArray (List Json)
| JObject (List { key : String, value : Json })
Classes
class Eq a where
class Eq a => Ord a where
order : a -> a -> Int
Returns the order that two values appear in. It returns -1 if the first value is lower than the second; 0 if they are the same; and +1 if the first value is greater than the second.
Instances
class Num a where
add : a<'m> -> a<'m> -> a<'m>
Addition
subtract : a<'m> -> a<'m> -> a<'m>
Subtraction
multiply : a<'m> -> a<'n> -> a<'m 'n>
Multiplication
fromInteger : Int -> a<1>
Conversion from an Int.
zero : a<'m>
The value zero.
Instances
class Num a => Real a where
divide : a<'m> -> a<'n> -> a<'m / 'n>
Division
sqrt : a<'m^2> -> a<'m>
Square root
floor : a<'m> -> Integer<'m>
Returns the largest Integer that is less than or equal to the supplied value.
pow : a<1> -> a<1> -> a<1>
Raise to the power of
exp : a<1> -> a<1>
Returns e raised to the supplied power.
ln : a<1> -> a<1>
Returns the natural logarithm of the supplied value.
log10 : a<1> -> a<1>
Returns the base 10 logarithm of the supplied value.
pi : a<1>
Returns the value of pi.
Instances
class Functor f where
map : (a -> b) -> f a -> f b
Returns the result of applying a function of type a -> b and a value of type f a to produce a value of type f b.
Instances
class Functor f => Applicative f where
pure : a -> f a
Lifts a supplied value into the structure.
apply : f (a -> b) -> f a -> f b
Sequential application
Instances
instance Applicative Listinstance Applicative Option
class ToString a where
class Semigroup a where
sappend : a -> a -> a
An associative binary operation.
Instances
class Semigroup a => Monoid a where
class Foldable t where
foldr : (a -> b -> b) -> b -> t a -> b
Right associative fold of a collection.
foldl : (b -> a -> b) -> b -> t a -> b
Left associative fold of a collection.
Instances
class (Functor t, Foldable t) => Traversable t where
traverse : forall f a b. Applicative f => (a -> f b) -> t a -> f (t b)
Map each element of a structure to an action, evaluate these actions from left to right and collect the results.
Instances
instance Traversable Listinstance Traversable Optioninstance Traversable (Map k)instance Traversable (Tree k)
class ToStringFormat a f where
toStringF : f -> a -> String
Instances
instance ToStringFormat Decimal<'m> Precisioninstance ToStringFormat Decimal<'m> PrecisionWithoutUnitinstance ToStringFormat Decimal<'m> WithoutUnitinstance ToStringFormat Integer<'m> WithoutUnit
class ToJson a where
Functions
compose : forall a b c. (b -> c) -> (a -> b) -> a -> c
Function composition of two supplied functions f and g.
flip : forall a b c. (a -> b -> c) -> b -> a -> c
Applies a function f to its first two arguments in reverse order.
identity : forall a. a -> a
The identity function.
concatMap : forall t a b. Foldable t => (a -> List b) -> t a -> List b
Returns the result of concatenating the applications of f to each element of a collection xs.
fold : forall t m. (Foldable t, Monoid m) => t m -> m
Returns the result of combining the elements of a supplied collection xs, whose elements are Monoids, using Semigroup’s sappend function.
sum : forall t n 'm. (Foldable t, Num n) => t (n<'m>) -> n<'m>
Returns the sum of the elements of a supplied collection xs.
product : forall t n. (Foldable t, Num n) => t (n<1>) -> n<1>
Returns the product of the elements of a supplied collection xs.
head : forall t a. Foldable t => t a -> Option a
Returns the first element of a supplied collection xs if it exists.
any : forall t a. Foldable t => (a -> Bool) -> t a -> Bool
Returns whether any element of the supplied collection xs satisfies the predicate p.
all : forall t a. Foldable t => (a -> Bool) -> t a -> Bool
Returns whether all elements of the supplied collection xs satisfy the predicate p.
find : forall t a. Foldable t => (a -> Bool) -> t a -> Option a
Returns the left-most element of the supplied collection xs that satisfies the predicate p.
maximum : forall t a. (Foldable t, Ord a) => t a -> Option a
Returns the largest element of the supplied collection xs if it exists.
minimum : forall t a. (Foldable t, Ord a) => t a -> Option a
Returns the smallest element of the supplied collection xs if it exists.
length : forall t a. Foldable t => t a -> Int
Returns the length of the supplied collection xs.
mean : forall t n 'm. (Foldable t, Real n) => t (n<'m>) -> Option (n<'m>)
Returns the mean value of the elements of the supplied collection xs when possible.
sort : forall a. Ord a => List a -> List a
Returns the elements of the supplied List xs ordered from lowest to highest, keeping duplicates in the order they appeared in the input.
groupBy : forall t a b. (Foldable t, Eq b) => (a -> b) -> t a -> List { key : b, values : List a }
Returns the result of partitioning the supplied collection xs by some discriminating function f.
median : forall t n 'm. (Foldable t, Real n, Ord (n<'m>)) => t (n<'m>) -> Option (n<'m>)
Returns the median value of the elements of the supplied collection xs when possible.
sequence : forall f t a. (Applicative f, Traversable t) => t (f a) -> f (t a)
Evaluate each action in the collection from left to right and collect the results.
divMod : forall 'm. Integer<'m> -> Integer<'m> -> { quot : Int, rem : Integer<'m> }
Returns the result of the Integer division and remainder of two values with the quotient rounded toward negative infinity.