The CSL Standard Library
This section gives an overview of the types and functions which are currently available from the CSL standard library. A number of types are built-in and therefore not defined in the standard library. The complete source code of the standard library can be seen here.
- Functions operating on numbers
Int::toFloat : Int -> Float
Int::toString : Int -> String
Float::toInt : Float -> Int
Math::abs : Int -> Int
Math::fabs : Float -> Float
Math::pow : Float -> Float -> Float
Math::sqrt : Float -> Float
Math::round : Float -> Int -> RoundingMode -> Float
Math::ceiling : Float -> Float
Math::floor : Float -> Float
- String functions
- Boolean functions
Instant
Time
Year
Month
Date
DateTime
DayCount
ZonedDateTime
components : ZonedDateTime -> ZonedDateTime::ComponentsWithOffset
fromComponents : ZonedDateTime::Components -> ZonedDateTime
fromComponentsWithOffset : ZonedDateTime::ComponentsWithOffset -> ZonedDateTime
from : Date -> Time -> String -> ZonedDateTime
fromStrict : Date -> Time -> String -> ZoneOffset -> ZonedDateTime
fromInstant : Instant -> String -> ZonedDateTime
withEarlierOffsetAtOverlap : ZonedDateTime -> ZonedDateTime
withLaterOffsetAtOverlap : ZonedDateTime -> ZonedDateTime
addPeriod : Period -> ZonedDateTime -> ZonedDateTime
addDuration : Duration -> ZonedDateTime -> ZonedDateTime
instant : ZonedDateTime -> Instant
Period
Duration
Duration::betweenInstants : Instant -> Instant -> Duration
Duration::betweenTimes : Time -> Time -> Duration
Duration::add : Duration -> Duration -> Duration
Duration::negate : Duration -> Duration -> Duration
Duration::components : Duration -> Duration::Components
Duration::fromComponents : Duration::Components -> Duration
Duration::from : Int -> Int -> Duration
Duration::fromMinutes : Int -> Duration
Duration::fromHours : Int -> Duration
Duration::fromDays : Float -> Duration
- Signed functions
- General combinators
Tuple
Maybe
maybe : b -> (a -> b) -> Maybe a -> b
fromMaybe : a -> Maybe a -> a
Maybe::map : (a -> b) -> Maybe a -> Maybe b
Maybe::map2 : (a -> b -> c) -> Maybe a -> Maybe b -> Maybe c
Maybe::isSome : Maybe a -> Bool
Maybe::any : (a -> Bool) -> Maybe a -> Bool
Maybe::all : (a -> Bool) -> Maybe a -> Bool
Maybe::bind : (a -> Maybe b) -> Maybe a -> Maybe b
Ordering
compareInt : Int -> Int -> Ordering
compareFloat : Float -> Float -> Ordering
compareInstant : Instant -> Instant -> Ordering
compareDate : Date -> Date -> Ordering
compareTime : Time -> Time -> Ordering
Ordering::twoStep : (a -> a -> Ordering) -> (a -> a -> Ordering) -> a -> a -> Ordering
Ordering::lexicographic : (a -> a -> Ordering) -> (a -> a -> Ordering) -> a -> a -> Ordering
List
- Folding lists with
foldl
andfoldr
- Choosing between
foldr
andfoldl
List::head : List a -> Maybe a
List::headOrDefault : a -> List a -> a
List::tail : List a -> Maybe (List a)
List::minimum : (a -> a -> Ordering) -> List a -> Maybe a
List::maximum : (a -> a -> Ordering) -> List a -> Maybe a
List::contains : a -> List a -> Bool
List::sort : (a -> a -> Ordering) -> List a -> List a
List::isSorted : (a -> a -> Ordering) -> List a -> Bool
List::length : List a -> Int
List::isEmpty : List a -> Boolean
List::map : (a -> b) -> List a -> List b
List::mapMaybe : (a -> Maybe b) -> List a -> List b
List::filter : (a -> Bool) -> List a -> List a
List::zipWith : (a -> b -> c) -> List a -> List b -> List c
List::zip : List a -> List b -> List (Tuple a b)
List::any : (a -> Bool) -> List a -> Bool
List::all : (a -> Bool) -> List a -> Bool
List::first : (a -> Bool) -> List a -> Maybe a
List::last : (a -> Bool) -> List a -> Maybe a
List::append : List a -> List a -> List a
List::concat : List (List a) -> List a
List::concatMap : (a -> List b) -> List a -> List b
List::reverse : List a -> List a
List::take : Int -> List a -> List a
List::takeWhile : (a -> Bool) -> List a -> List a
List::drop : Int -> List a -> List a
- Folding lists with
NonEmptyList
- Use in contracts
NonEmptyList::toList : NonEmptyList a -> List a
NonEmptyList::fromList : List a -> Maybe (NonEmptyList a)
NonEmptyList::singleton : a -> NonEmptyList a
NonEmptyList::head : NonEmptyList a -> a
NonEmptyList::tail : NonEmptyList a -> List a
NonEmptyList::minimum : (a -> a -> Ordering) -> NonEmptyList a -> a
NonEmptyList::maximum : (a -> a -> Ordering) -> NonEmptyList a -> a
NonEmptyList::contains : a -> NonEmptyList a -> Bool
NonEmptyList::sort : (a -> a -> Ordering) -> NonEmptyList a -> NonEmptyList a
NonEmptyList::isSorted : (a -> a -> Ordering) -> NonEmptyList a -> Bool
NonEmptyList::length : NonEmptyList a -> Int
NonEmptyList::map : (a -> b) -> NonEmptyList a -> NonEmptyList b
NonEmptyList::zipWith : (a -> b -> c) -> NonEmptyList a -> NonEmptyList b -> NonEmptyList c
NonEmptyList::zip : NonEmptyList a -> NonEmptyList b -> NonEmptyList (Tuple a b)
NonEmptyList::any : (a -> Bool) -> NonEmptyList a -> Bool
NonEmptyList::all : (a -> Bool) -> NonEmptyList a -> Bool
NonEmptyList::first : (a -> Bool) -> NonEmptyList a -> Maybe a
NonEmptyList::last : (a -> Bool) -> NonEmptyList a -> Maybe a
NonEmptyList::append : NonEmptyList a -> NonEmptyList a -> NonEmptyList a
NonEmptyList::concat : NonEmptyList (NonEmptyList a) -> NonEmptyList a
NonEmptyList::concatMap : (a -> NonEmptyList b) -> NonEmptyList a -> NonEmptyList b
NonEmptyList::final : NonEmptyList a -> a
NonEmptyList::reverse : NonEmptyList a -> NonEmptyList a
Map
Map::empty : Map k v
Map::insert : k -> v -> Map k v -> Map k v
Map::remove : k -> Map k v -> Map k v
Map::lookup : k -> Map k v -> Maybe v
Map::lookupOrDefault : v -> k -> Map k v -> Maybe v
Map::fold : (k -> v -> a -> a) -> a -> Map k v -> a
Map::fromList : List (Tuple k v) -> Map k v
Map::toList : Map k v -> List (Tuple k v)
Set
Set::empty : Set v
Set::insert : v -> Set v -> Set v
Set::remove : v -> Set v -> Set v
Set::fold : (v -> a -> a) -> a -> Set v -> a
Set::contains : v -> Set v -> Bool
Set::union : Set v -> Set v -> Set v
Set::intersection : Set v -> Set v -> Set v
Set::difference : Set v -> Set v -> Set v
Set::singleton : v -> Set v
Set::fromList : List v -> Set v
Set::toList : Set v -> List v
Set::size : Set v -> Int
Event
RoundingMode
- Features for Testing CSL
- Built-in functions and types
- CSL standard library source code