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 -> FloatInt::toString : Int -> StringFloat::toInt : Float -> IntMath::abs : Int -> IntMath::fabs : Float -> FloatMath::pow : Float -> Float -> FloatMath::sqrt : Float -> FloatMath::round : Float -> Int -> RoundingMode -> FloatMath::ceiling : Float -> FloatMath::floor : Float -> Float
- String functions
- Boolean functions
InstantTimeYearMonthDateDateTimeDayCountZonedDateTimecomponents : ZonedDateTime -> ZonedDateTime::ComponentsWithOffsetfromComponents : ZonedDateTime::Components -> ZonedDateTimefromComponentsWithOffset : ZonedDateTime::ComponentsWithOffset -> ZonedDateTimefrom : Date -> Time -> String -> ZonedDateTimefromStrict : Date -> Time -> String -> ZoneOffset -> ZonedDateTimefromInstant : Instant -> String -> ZonedDateTimewithEarlierOffsetAtOverlap : ZonedDateTime -> ZonedDateTimewithLaterOffsetAtOverlap : ZonedDateTime -> ZonedDateTimeaddPeriod : Period -> ZonedDateTime -> ZonedDateTimeaddDuration : Duration -> ZonedDateTime -> ZonedDateTimeinstant : ZonedDateTime -> Instant
PeriodDurationDuration::betweenInstants : Instant -> Instant -> DurationDuration::betweenTimes : Time -> Time -> DurationDuration::add : Duration -> Duration -> DurationDuration::negate : Duration -> Duration -> DurationDuration::components : Duration -> Duration::ComponentsDuration::fromComponents : Duration::Components -> DurationDuration::from : Int -> Int -> DurationDuration::fromMinutes : Int -> DurationDuration::fromHours : Int -> DurationDuration::fromDays : Float -> Duration
- Signed functions
- General combinators
TupleMaybemaybe : b -> (a -> b) -> Maybe a -> bfromMaybe : a -> Maybe a -> aMaybe::map : (a -> b) -> Maybe a -> Maybe bMaybe::map2 : (a -> b -> c) -> Maybe a -> Maybe b -> Maybe cMaybe::isSome : Maybe a -> BoolMaybe::any : (a -> Bool) -> Maybe a -> BoolMaybe::all : (a -> Bool) -> Maybe a -> BoolMaybe::bind : (a -> Maybe b) -> Maybe a -> Maybe b
OrderingcompareInt : Int -> Int -> OrderingcompareFloat : Float -> Float -> OrderingcompareInstant : Instant -> Instant -> OrderingcompareDate : Date -> Date -> OrderingcompareTime : Time -> Time -> OrderingOrdering::twoStep : (a -> a -> Ordering) -> (a -> a -> Ordering) -> a -> a -> OrderingOrdering::lexicographic : (a -> a -> Ordering) -> (a -> a -> Ordering) -> a -> a -> Ordering
List- Folding lists with
foldlandfoldr - Choosing between
foldrandfoldl List::head : List a -> Maybe aList::headOrDefault : a -> List a -> aList::tail : List a -> Maybe (List a)List::minimum : (a -> a -> Ordering) -> List a -> Maybe aList::maximum : (a -> a -> Ordering) -> List a -> Maybe aList::contains : a -> List a -> BoolList::sort : (a -> a -> Ordering) -> List a -> List aList::isSorted : (a -> a -> Ordering) -> List a -> BoolList::length : List a -> IntList::isEmpty : List a -> BooleanList::map : (a -> b) -> List a -> List bList::mapMaybe : (a -> Maybe b) -> List a -> List bList::filter : (a -> Bool) -> List a -> List aList::zipWith : (a -> b -> c) -> List a -> List b -> List cList::zip : List a -> List b -> List (Tuple a b)List::any : (a -> Bool) -> List a -> BoolList::all : (a -> Bool) -> List a -> BoolList::first : (a -> Bool) -> List a -> Maybe aList::last : (a -> Bool) -> List a -> Maybe aList::append : List a -> List a -> List aList::concat : List (List a) -> List aList::concatMap : (a -> List b) -> List a -> List bList::reverse : List a -> List aList::take : Int -> List a -> List aList::takeWhile : (a -> Bool) -> List a -> List aList::drop : Int -> List a -> List a
- Folding lists with
NonEmptyList- Use in contracts
NonEmptyList::toList : NonEmptyList a -> List aNonEmptyList::fromList : List a -> Maybe (NonEmptyList a)NonEmptyList::singleton : a -> NonEmptyList aNonEmptyList::head : NonEmptyList a -> aNonEmptyList::tail : NonEmptyList a -> List aNonEmptyList::minimum : (a -> a -> Ordering) -> NonEmptyList a -> aNonEmptyList::maximum : (a -> a -> Ordering) -> NonEmptyList a -> aNonEmptyList::contains : a -> NonEmptyList a -> BoolNonEmptyList::sort : (a -> a -> Ordering) -> NonEmptyList a -> NonEmptyList aNonEmptyList::isSorted : (a -> a -> Ordering) -> NonEmptyList a -> BoolNonEmptyList::length : NonEmptyList a -> IntNonEmptyList::map : (a -> b) -> NonEmptyList a -> NonEmptyList bNonEmptyList::zipWith : (a -> b -> c) -> NonEmptyList a -> NonEmptyList b -> NonEmptyList cNonEmptyList::zip : NonEmptyList a -> NonEmptyList b -> NonEmptyList (Tuple a b)NonEmptyList::any : (a -> Bool) -> NonEmptyList a -> BoolNonEmptyList::all : (a -> Bool) -> NonEmptyList a -> BoolNonEmptyList::first : (a -> Bool) -> NonEmptyList a -> Maybe aNonEmptyList::last : (a -> Bool) -> NonEmptyList a -> Maybe aNonEmptyList::append : NonEmptyList a -> NonEmptyList a -> NonEmptyList aNonEmptyList::concat : NonEmptyList (NonEmptyList a) -> NonEmptyList aNonEmptyList::concatMap : (a -> NonEmptyList b) -> NonEmptyList a -> NonEmptyList bNonEmptyList::final : NonEmptyList a -> aNonEmptyList::reverse : NonEmptyList a -> NonEmptyList a
MapMap::empty : Map k vMap::insert : k -> v -> Map k v -> Map k vMap::remove : k -> Map k v -> Map k vMap::lookup : k -> Map k v -> Maybe vMap::lookupOrDefault : v -> k -> Map k v -> Maybe vMap::fold : (k -> v -> a -> a) -> a -> Map k v -> aMap::fromList : List (Tuple k v) -> Map k vMap::toList : Map k v -> List (Tuple k v)
SetSet::empty : Set vSet::insert : v -> Set v -> Set vSet::remove : v -> Set v -> Set vSet::fold : (v -> a -> a) -> a -> Set v -> aSet::contains : v -> Set v -> BoolSet::union : Set v -> Set v -> Set vSet::intersection : Set v -> Set v -> Set vSet::difference : Set v -> Set v -> Set vSet::singleton : v -> Set vSet::fromList : List v -> Set vSet::toList : Set v -> List vSet::size : Set v -> Int
EventRoundingMode- Features for Testing CSL
- Built-in functions and types
- CSL standard library source code