From 89ff7f20f1441ad1ca2bbf55c60fbb305e2fd10b Mon Sep 17 00:00:00 2001 From: David Chambers Date: Sun, 3 Nov 2019 19:46:49 +0100 Subject: [PATCH] Version 2.0.1 --- README.md | 340 +++++++++++++++++++++++++-------------------------- package.json | 2 +- 2 files changed, 171 insertions(+), 171 deletions(-) diff --git a/README.md b/README.md index f43eae8f..212bff88 100644 --- a/README.md +++ b/README.md @@ -280,7 +280,7 @@ S.add (2) (true); // // The value at position 1 is not a member of ‘FiniteNumber’. // -// See https://github.com/sanctuary-js/sanctuary-def/tree/v0.20.0#FiniteNumber for information about the FiniteNumber type. +// See https://github.com/sanctuary-js/sanctuary-def/tree/v0.20.1#FiniteNumber for information about the FiniteNumber type. ``` Compare this to the behaviour of Ramda's unchecked equivalent: @@ -339,7 +339,7 @@ const $ = window.sanctuaryDef; ### Configure -#### `create :: { checkTypes :: Boolean, env :: Array Type } -⁠> Module` +#### `create :: { checkTypes :: Boolean, env :: Array Type } -⁠> Module` Takes an options record and returns a Sanctuary module. `checkTypes` specifies whether to enable type checking. The module's polymorphic @@ -393,7 +393,7 @@ S.map (S.sub (1)) (Identity (43)); See also [`env`](#env). -#### `env :: Array Type` +#### `env :: Array Type` The Sanctuary module's environment (`(S.create ({checkTypes, env})).env` is a reference to `env`). Useful in conjunction with [`create`](#create). @@ -426,7 +426,7 @@ is a reference to `env`). Useful in conjunction with [`create`](#create). . $.Undefined ] ``` -#### `unchecked :: Module` +#### `unchecked :: Module` A complete Sanctuary module that performs no type checking. This is useful as it permits operations that Sanctuary's type checking would @@ -448,7 +448,7 @@ Opting out of type checking may cause type errors to go unnoticed. ### Classify -#### `type :: Any -⁠> { namespace :: Maybe String, name :: String, version :: NonNegativeInteger }` +#### `type :: Any -⁠> { namespace :: Maybe String, name :: String, version :: NonNegativeInteger }` Returns the result of parsing the [type identifier][] of the given value. @@ -460,7 +460,7 @@ Returns the result of parsing the [type identifier][] of the given value. {namespace: Nothing, name: 'Array', version: 0} ``` -#### `is :: Type -⁠> Any -⁠> Boolean` +#### `is :: Type -⁠> Any -⁠> Boolean` Returns `true` [iff][] the given value is a member of the specified type. See [`$.test`][] for details. @@ -475,7 +475,7 @@ false ### Showable -#### `show :: Any -⁠> String` +#### `show :: Any -⁠> String` Alias of [`show`][]. @@ -497,7 +497,7 @@ Alias of [`show`][]. Sanctuary is compatible with the [Fantasy Land][] specification. -#### `equals :: Setoid a => a -⁠> a -⁠> Boolean` +#### `equals :: Setoid a => a -⁠> a -⁠> Boolean` Curried version of [`Z.equals`][] that requires two arguments of the same type. @@ -520,7 +520,7 @@ true false ``` -#### `lt :: Ord a => a -⁠> a -⁠> Boolean` +#### `lt :: Ord a => a -⁠> a -⁠> Boolean` Returns `true` [iff][] the *second* argument is less than the first according to [`Z.lt`][]. @@ -530,7 +530,7 @@ according to [`Z.lt`][]. [1, 2] ``` -#### `lte :: Ord a => a -⁠> a -⁠> Boolean` +#### `lte :: Ord a => a -⁠> a -⁠> Boolean` Returns `true` [iff][] the *second* argument is less than or equal to the first according to [`Z.lte`][]. @@ -540,7 +540,7 @@ the first according to [`Z.lte`][]. [1, 2, 3] ``` -#### `gt :: Ord a => a -⁠> a -⁠> Boolean` +#### `gt :: Ord a => a -⁠> a -⁠> Boolean` Returns `true` [iff][] the *second* argument is greater than the first according to [`Z.gt`][]. @@ -550,7 +550,7 @@ according to [`Z.gt`][]. [4, 5] ``` -#### `gte :: Ord a => a -⁠> a -⁠> Boolean` +#### `gte :: Ord a => a -⁠> a -⁠> Boolean` Returns `true` [iff][] the *second* argument is greater than or equal to the first according to [`Z.gte`][]. @@ -560,7 +560,7 @@ to the first according to [`Z.gte`][]. [3, 4, 5] ``` -#### `min :: Ord a => a -⁠> a -⁠> a` +#### `min :: Ord a => a -⁠> a -⁠> a` Returns the smaller of its two arguments (according to [`Z.lte`][]). @@ -577,7 +577,7 @@ new Date ('1999-12-31') '10' ``` -#### `max :: Ord a => a -⁠> a -⁠> a` +#### `max :: Ord a => a -⁠> a -⁠> a` Returns the larger of its two arguments (according to [`Z.lte`][]). @@ -594,7 +594,7 @@ new Date ('2000-01-01') '2' ``` -#### `clamp :: Ord a => a -⁠> a -⁠> a -⁠> a` +#### `clamp :: Ord a => a -⁠> a -⁠> a -⁠> a` Takes a lower bound, an upper bound, and a value of the same type. Returns the value if it is within the bounds; the nearer bound otherwise. @@ -612,7 +612,7 @@ See also [`min`](#min) and [`max`](#max). 'Z' ``` -#### `id :: Category c => TypeRep c -⁠> c` +#### `id :: Category c => TypeRep c -⁠> c` [Type-safe][sanctuary-def] version of [`Z.id`][]. @@ -621,7 +621,7 @@ See also [`min`](#min) and [`max`](#max). 42 ``` -#### `concat :: Semigroup a => a -⁠> a -⁠> a` +#### `concat :: Semigroup a => a -⁠> a -⁠> a` Curried version of [`Z.concat`][]. @@ -642,7 +642,7 @@ Just ([1, 2, 3, 4, 5, 6]) Sum (42) ``` -#### `empty :: Monoid a => TypeRep a -⁠> a` +#### `empty :: Monoid a => TypeRep a -⁠> a` [Type-safe][sanctuary-def] version of [`Z.empty`][]. @@ -660,7 +660,7 @@ Sum (42) Sum (0) ``` -#### `invert :: Group g => g -⁠> g` +#### `invert :: Group g => g -⁠> g` [Type-safe][sanctuary-def] version of [`Z.invert`][]. @@ -669,7 +669,7 @@ Sum (0) Sum (-5) ``` -#### `filter :: Filterable f => (a -⁠> Boolean) -⁠> f a -⁠> f a` +#### `filter :: Filterable f => (a -⁠> Boolean) -⁠> f a -⁠> f a` Curried version of [`Z.filter`][]. Discards every element that does not satisfy the predicate. @@ -693,7 +693,7 @@ Nothing Just (1) ``` -#### `reject :: Filterable f => (a -⁠> Boolean) -⁠> f a -⁠> f a` +#### `reject :: Filterable f => (a -⁠> Boolean) -⁠> f a -⁠> f a` Curried version of [`Z.reject`][]. Discards every element that satisfies the predicate. @@ -717,7 +717,7 @@ Just (0) Nothing ``` -#### `map :: Functor f => (a -⁠> b) -⁠> f a -⁠> f b` +#### `map :: Functor f => (a -⁠> b) -⁠> f a -⁠> f b` Curried version of [`Z.map`][]. @@ -753,7 +753,7 @@ from combinatory logic (i.e. [`compose`](#compose)): 10 ``` -#### `flip :: Functor f => f (a -⁠> b) -⁠> a -⁠> f b` +#### `flip :: Functor f => f (a -⁠> b) -⁠> a -⁠> f b` Curried version of [`Z.flip`][]. Maps over the given functions, applying each to the given value. @@ -782,7 +782,7 @@ from combinatory logic: Cons (1) (Cons (2) (Nil)) ``` -#### `bimap :: Bifunctor f => (a -⁠> b) -⁠> (c -⁠> d) -⁠> f a c -⁠> f b d` +#### `bimap :: Bifunctor f => (a -⁠> b) -⁠> (c -⁠> d) -⁠> f a c -⁠> f b d` Curried version of [`Z.bimap`][]. @@ -797,7 +797,7 @@ Left ('FOO') Right (8) ``` -#### `mapLeft :: Bifunctor f => (a -⁠> b) -⁠> f a c -⁠> f b c` +#### `mapLeft :: Bifunctor f => (a -⁠> b) -⁠> f a c -⁠> f b c` Curried version of [`Z.mapLeft`][]. Maps the given function over the left side of a Bifunctor. @@ -813,7 +813,7 @@ Left ('FOO') Right (64) ``` -#### `promap :: Profunctor p => (a -⁠> b) -⁠> (c -⁠> d) -⁠> p b c -⁠> p a d` +#### `promap :: Profunctor p => (a -⁠> b) -⁠> (c -⁠> d) -⁠> p b c -⁠> p a d` Curried version of [`Z.promap`][]. @@ -822,7 +822,7 @@ Curried version of [`Z.promap`][]. 11 ``` -#### `alt :: Alt f => f a -⁠> f a -⁠> f a` +#### `alt :: Alt f => f a -⁠> f a -⁠> f a` Curried version of [`Z.alt`][] with arguments flipped to facilitate partial application. @@ -841,7 +841,7 @@ Right (0) Right (1) ``` -#### `zero :: Plus f => TypeRep f -⁠> f a` +#### `zero :: Plus f => TypeRep f -⁠> f a` [Type-safe][sanctuary-def] version of [`Z.zero`][]. @@ -856,7 +856,7 @@ Right (1) Nothing ``` -#### `reduce :: Foldable f => (b -⁠> a -⁠> b) -⁠> b -⁠> f a -⁠> b` +#### `reduce :: Foldable f => (b -⁠> a -⁠> b) -⁠> b -⁠> f a -⁠> b` Takes a curried binary function, an initial value, and a [Foldable][], and applies the function to the initial value and the Foldable's first @@ -874,7 +874,7 @@ otherwise. [5, 4, 3, 2, 1] ``` -#### `traverse :: (Applicative f, Traversable t) => TypeRep f -⁠> (a -⁠> f b) -⁠> t a -⁠> f (t b)` +#### `traverse :: (Applicative f, Traversable t) => TypeRep f -⁠> (a -⁠> f b) -⁠> t a -⁠> f (t b)` Curried version of [`Z.traverse`][]. @@ -898,7 +898,7 @@ Just ({a: 10, b: 11, c: 12}) Nothing ``` -#### `sequence :: (Applicative f, Traversable t) => TypeRep f -⁠> t (f a) -⁠> f (t a)` +#### `sequence :: (Applicative f, Traversable t) => TypeRep f -⁠> t (f a) -⁠> f (t a)` Curried version of [`Z.sequence`][]. Inverts the given `t (f a)` to produce an `f (t a)`. @@ -920,7 +920,7 @@ Just ({a: 1, b: 2, c: 3}) Nothing ``` -#### `ap :: Apply f => f (a -⁠> b) -⁠> f a -⁠> f b` +#### `ap :: Apply f => f (a -⁠> b) -⁠> f a -⁠> f b` Curried version of [`Z.ap`][]. @@ -950,7 +950,7 @@ from combinatory logic: 'Hask' ``` -#### `lift2 :: Apply f => (a -⁠> b -⁠> c) -⁠> f a -⁠> f b -⁠> f c` +#### `lift2 :: Apply f => (a -⁠> b -⁠> c) -⁠> f a -⁠> f b -⁠> f c` Promotes a curried binary function to a function that operates on two [Apply][]s. @@ -969,7 +969,7 @@ Just (true) Just (false) ``` -#### `lift3 :: Apply f => (a -⁠> b -⁠> c -⁠> d) -⁠> f a -⁠> f b -⁠> f c -⁠> f d` +#### `lift3 :: Apply f => (a -⁠> b -⁠> c -⁠> d) -⁠> f a -⁠> f b -⁠> f c -⁠> f d` Promotes a curried ternary function to a function that operates on three [Apply][]s. @@ -982,7 +982,7 @@ Just (6) Nothing ``` -#### `apFirst :: Apply f => f a -⁠> f b -⁠> f a` +#### `apFirst :: Apply f => f a -⁠> f b -⁠> f a` Curried version of [`Z.apFirst`][]. Combines two effectful actions, keeping only the result of the first. Equivalent to Haskell's `(<*)` @@ -998,7 +998,7 @@ See also [`apSecond`](#apSecond). Just (1) ``` -#### `apSecond :: Apply f => f a -⁠> f b -⁠> f b` +#### `apSecond :: Apply f => f a -⁠> f b -⁠> f b` Curried version of [`Z.apSecond`][]. Combines two effectful actions, keeping only the result of the second. Equivalent to Haskell's `(*>)` @@ -1014,7 +1014,7 @@ See also [`apFirst`](#apFirst). Just (2) ``` -#### `of :: Applicative f => TypeRep f -⁠> a -⁠> f a` +#### `of :: Applicative f => TypeRep f -⁠> a -⁠> f a` Curried version of [`Z.of`][]. @@ -1032,7 +1032,7 @@ Just (42) Right (42) ``` -#### `chain :: Chain m => (a -⁠> m b) -⁠> m a -⁠> m b` +#### `chain :: Chain m => (a -⁠> m b) -⁠> m a -⁠> m b` Curried version of [`Z.chain`][]. @@ -1050,7 +1050,7 @@ Just (123) Nothing ``` -#### `join :: Chain m => m (m a) -⁠> m a` +#### `join :: Chain m => m (m a) -⁠> m a` [Type-safe][sanctuary-def] version of [`Z.join`][]. Removes one level of nesting from a nested monadic structure. @@ -1081,7 +1081,7 @@ from combinatory logic: 'abcabc' ``` -#### `chainRec :: ChainRec m => TypeRep m -⁠> (a -⁠> m (Either a b)) -⁠> a -⁠> m b` +#### `chainRec :: ChainRec m => TypeRep m -⁠> (a -⁠> m (Either a b)) -⁠> a -⁠> m b` Performs a [`chain`](#chain)-like computation with constant stack usage. Similar to [`Z.chainRec`][], but curried and more convenient due to the @@ -1095,7 +1095,7 @@ use of the Either type to indicate completion (via a Right). ['oo!', 'oo?', 'on!', 'on?', 'no!', 'no?', 'nn!', 'nn?'] ``` -#### `extend :: Extend w => (w a -⁠> b) -⁠> w a -⁠> w b` +#### `extend :: Extend w => (w a -⁠> b) -⁠> w a -⁠> w b` Curried version of [`Z.extend`][]. @@ -1107,7 +1107,7 @@ Curried version of [`Z.extend`][]. [4, 3, 2, 1] ``` -#### `duplicate :: Extend w => w a -⁠> w (w a)` +#### `duplicate :: Extend w => w a -⁠> w (w a)` [Type-safe][sanctuary-def] version of [`Z.duplicate`][]. Adds one level of nesting to a comonadic structure. @@ -1126,7 +1126,7 @@ Just (Just (1)) [4, 3, 2, 1] ``` -#### `extract :: Comonad w => w a -⁠> a` +#### `extract :: Comonad w => w a -⁠> a` [Type-safe][sanctuary-def] version of [`Z.extract`][]. @@ -1135,7 +1135,7 @@ Just (Just (1)) 'bar' ``` -#### `contramap :: Contravariant f => (b -⁠> a) -⁠> f a -⁠> f b` +#### `contramap :: Contravariant f => (b -⁠> a) -⁠> f a -⁠> f b` [Type-safe][sanctuary-def] version of [`Z.contramap`][]. @@ -1146,7 +1146,7 @@ Just (Just (1)) ### Combinator -#### `I :: a -⁠> a` +#### `I :: a -⁠> a` The I combinator. Returns its argument. Equivalent to Haskell's `id` function. @@ -1156,7 +1156,7 @@ function. 'foo' ``` -#### `K :: a -⁠> b -⁠> a` +#### `K :: a -⁠> b -⁠> a` The K combinator. Takes two values and returns the first. Equivalent to Haskell's `const` function. @@ -1169,7 +1169,7 @@ Haskell's `const` function. [42, 42, 42, 42, 42] ``` -#### `T :: a -⁠> (a -⁠> b) -⁠> b` +#### `T :: a -⁠> (a -⁠> b) -⁠> b` The T ([thrush][]) combinator. Takes a value and a function, and returns the result of applying the function to the value. Equivalent to Haskell's @@ -1185,7 +1185,7 @@ the result of applying the function to the value. Equivalent to Haskell's ### Function -#### `curry2 :: ((a, b) -⁠> c) -⁠> a -⁠> b -⁠> c` +#### `curry2 :: ((a, b) -⁠> c) -⁠> a -⁠> b -⁠> c` Curries the given binary function. @@ -1194,7 +1194,7 @@ Curries the given binary function. [10, 100, 1000] ``` -#### `curry3 :: ((a, b, c) -⁠> d) -⁠> a -⁠> b -⁠> c -⁠> d` +#### `curry3 :: ((a, b, c) -⁠> d) -⁠> a -⁠> b -⁠> c -⁠> d` Curries the given ternary function. @@ -1207,7 +1207,7 @@ Curries the given ternary function. 'orange icecream' ``` -#### `curry4 :: ((a, b, c, d) -⁠> e) -⁠> a -⁠> b -⁠> c -⁠> d -⁠> e` +#### `curry4 :: ((a, b, c, d) -⁠> e) -⁠> a -⁠> b -⁠> c -⁠> d -⁠> e` Curries the given quaternary function. @@ -1220,7 +1220,7 @@ Curries the given quaternary function. {x: 0, y: 0, width: 10, height: 10} ``` -#### `curry5 :: ((a, b, c, d, e) -⁠> f) -⁠> a -⁠> b -⁠> c -⁠> d -⁠> e -⁠> f` +#### `curry5 :: ((a, b, c, d, e) -⁠> f) -⁠> a -⁠> b -⁠> c -⁠> d -⁠> e -⁠> f` Curries the given quinary function. @@ -1239,7 +1239,7 @@ Curries the given quinary function. ### Composition -#### `compose :: Semigroupoid s => s b c -⁠> s a b -⁠> s a c` +#### `compose :: Semigroupoid s => s b c -⁠> s a b -⁠> s a c` Curried version of [`Z.compose`][]. @@ -1256,7 +1256,7 @@ See also [`pipe`](#pipe). 10 ``` -#### `pipe :: Foldable f => f (Any -⁠> Any) -⁠> a -⁠> b` +#### `pipe :: Foldable f => f (Any -⁠> Any) -⁠> a -⁠> b` Takes a sequence of functions assumed to be unary and a value of any type, and returns the result of applying the sequence of transformations @@ -1270,7 +1270,7 @@ of functions. `pipe ([f, g, h]) (x)` is equivalent to `h (g (f (x)))`. 9 ``` -#### `pipeK :: (Foldable f, Chain m) => f (Any -⁠> m Any) -⁠> m a -⁠> m b` +#### `pipeK :: (Foldable f, Chain m) => f (Any -⁠> m Any) -⁠> m a -⁠> m b` Takes a sequence of functions assumed to be unary that return values with a [Chain][], and a value of that Chain, and returns the result @@ -1285,7 +1285,7 @@ of an sequence of functions. `pipeK ([f, g, h]) (x)` is equivalent to Just (3) ``` -#### `on :: (b -⁠> b -⁠> c) -⁠> (a -⁠> b) -⁠> a -⁠> a -⁠> c` +#### `on :: (b -⁠> b -⁠> c) -⁠> (a -⁠> b) -⁠> a -⁠> a -⁠> c` Takes a binary function `f`, a unary function `g`, and two values `x` and `y`. Returns `f (g (x)) (g (y))`. @@ -1304,7 +1304,7 @@ contains exactly two values: one of type `a`; one of type `b`. The implementation is provided by [sanctuary-pair][]. -#### `Pair :: a -⁠> b -⁠> Pair a b` +#### `Pair :: a -⁠> b -⁠> Pair a b` Pair's sole data constructor. Additionally, it serves as the Pair [type representative][]. @@ -1314,7 +1314,7 @@ Pair [type representative][]. Pair ('foo') (42) ``` -#### `pair :: (a -⁠> b -⁠> c) -⁠> Pair a b -⁠> c` +#### `pair :: (a -⁠> b -⁠> c) -⁠> Pair a b -⁠> c` Case analysis for the `Pair a b` type. @@ -1323,7 +1323,7 @@ Case analysis for the `Pair a b` type. 'foobar' ``` -#### `fst :: Pair a b -⁠> a` +#### `fst :: Pair a b -⁠> a` `fst (Pair (x) (y))` is equivalent to `x`. @@ -1332,7 +1332,7 @@ Case analysis for the `Pair a b` type. 'foo' ``` -#### `snd :: Pair a b -⁠> b` +#### `snd :: Pair a b -⁠> b` `snd (Pair (x) (y))` is equivalent to `y`. @@ -1341,7 +1341,7 @@ Case analysis for the `Pair a b` type. 42 ``` -#### `swap :: Pair a b -⁠> Pair b a` +#### `swap :: Pair a b -⁠> Pair b a` `swap (Pair (x) (y))` is equivalent to `Pair (y) (x)`. @@ -1357,11 +1357,11 @@ either Nothing (the empty value) or a Just whose value is of type `a`. The implementation is provided by [sanctuary-maybe][]. -#### `Maybe :: TypeRep Maybe` +#### `Maybe :: TypeRep Maybe` Maybe [type representative][]. -#### `Nothing :: Maybe a` +#### `Nothing :: Maybe a` The empty value of type `Maybe a`. @@ -1370,7 +1370,7 @@ The empty value of type `Maybe a`. Nothing ``` -#### `Just :: a -⁠> Maybe a` +#### `Just :: a -⁠> Maybe a` Constructs a value of type `Maybe a` from a value of type `a`. @@ -1379,7 +1379,7 @@ Constructs a value of type `Maybe a` from a value of type `a`. Just (42) ``` -#### `isNothing :: Maybe a -⁠> Boolean` +#### `isNothing :: Maybe a -⁠> Boolean` Returns `true` if the given Maybe is Nothing; `false` if it is a Just. @@ -1391,7 +1391,7 @@ true false ``` -#### `isJust :: Maybe a -⁠> Boolean` +#### `isJust :: Maybe a -⁠> Boolean` Returns `true` if the given Maybe is a Just; `false` if it is Nothing. @@ -1403,7 +1403,7 @@ true false ``` -#### `fromMaybe :: a -⁠> Maybe a -⁠> a` +#### `fromMaybe :: a -⁠> Maybe a -⁠> a` Takes a default value and a Maybe, and returns the Maybe's value if the Maybe is a Just; the default value otherwise. @@ -1419,7 +1419,7 @@ See also [`fromMaybe_`](#fromMaybe_) and 0 ``` -#### `fromMaybe_ :: (() -⁠> a) -⁠> Maybe a -⁠> a` +#### `fromMaybe_ :: (() -⁠> a) -⁠> Maybe a -⁠> a` Variant of [`fromMaybe`](#fromMaybe) that takes a thunk so the default value is only computed if required. @@ -1434,7 +1434,7 @@ value is only computed if required. 832040 ``` -#### `maybeToNullable :: Maybe a -⁠> Nullable a` +#### `maybeToNullable :: Maybe a -⁠> Nullable a` Returns the given Maybe's value if the Maybe is a Just; `null` otherwise. [Nullable][] is defined in [sanctuary-def][]. @@ -1449,7 +1449,7 @@ See also [`fromMaybe`](#fromMaybe). null ``` -#### `maybe :: b -⁠> (a -⁠> b) -⁠> Maybe a -⁠> b` +#### `maybe :: b -⁠> (a -⁠> b) -⁠> Maybe a -⁠> b` Takes a value of any type, a function, and a Maybe. If the Maybe is a Just, the return value is the result of applying the function to @@ -1465,7 +1465,7 @@ See also [`maybe_`](#maybe_). 0 ``` -#### `maybe_ :: (() -⁠> b) -⁠> (a -⁠> b) -⁠> Maybe a -⁠> b` +#### `maybe_ :: (() -⁠> b) -⁠> (a -⁠> b) -⁠> Maybe a -⁠> b` Variant of [`maybe`](#maybe) that takes a thunk so the default value is only computed if required. @@ -1480,7 +1480,7 @@ is only computed if required. 832040 ``` -#### `justs :: (Filterable f, Functor f) => f (Maybe a) -⁠> f a` +#### `justs :: (Filterable f, Functor f) => f (Maybe a) -⁠> f a` Discards each element that is Nothing, and unwraps each element that is a Just. Related to Haskell's `catMaybes` function. @@ -1492,7 +1492,7 @@ See also [`lefts`](#lefts) and [`rights`](#rights). ['foo', 'baz'] ``` -#### `mapMaybe :: (Filterable f, Functor f) => (a -⁠> Maybe b) -⁠> f a -⁠> f b` +#### `mapMaybe :: (Filterable f, Functor f) => (a -⁠> Maybe b) -⁠> f a -⁠> f b` Takes a function and a structure, applies the function to each element of the structure, and returns the "successful" results. If the result of @@ -1507,7 +1507,7 @@ if the result is a Just, the Just's value is included. {x: 1, z: 4} ``` -#### `maybeToEither :: a -⁠> Maybe b -⁠> Either a b` +#### `maybeToEither :: a -⁠> Maybe b -⁠> Either a b` Converts a Maybe to an Either. Nothing becomes a Left (containing the first argument); a Just becomes a Right. @@ -1530,11 +1530,11 @@ value is of type `b`. The implementation is provided by [sanctuary-either][]. -#### `Either :: TypeRep Either` +#### `Either :: TypeRep Either` Either [type representative][]. -#### `Left :: a -⁠> Either a b` +#### `Left :: a -⁠> Either a b` Constructs a value of type `Either a b` from a value of type `a`. @@ -1543,7 +1543,7 @@ Constructs a value of type `Either a b` from a value of type `a`. Left ('Cannot divide by zero') ``` -#### `Right :: b -⁠> Either a b` +#### `Right :: b -⁠> Either a b` Constructs a value of type `Either a b` from a value of type `b`. @@ -1552,7 +1552,7 @@ Constructs a value of type `Either a b` from a value of type `b`. Right (42) ``` -#### `isLeft :: Either a b -⁠> Boolean` +#### `isLeft :: Either a b -⁠> Boolean` Returns `true` if the given Either is a Left; `false` if it is a Right. @@ -1564,7 +1564,7 @@ true false ``` -#### `isRight :: Either a b -⁠> Boolean` +#### `isRight :: Either a b -⁠> Boolean` Returns `true` if the given Either is a Right; `false` if it is a Left. @@ -1576,7 +1576,7 @@ true false ``` -#### `fromEither :: b -⁠> Either a b -⁠> b` +#### `fromEither :: b -⁠> Either a b -⁠> b` Takes a default value and an Either, and returns the Right value if the Either is a Right; the default value otherwise. @@ -1589,7 +1589,7 @@ if the Either is a Right; the default value otherwise. 0 ``` -#### `either :: (a -⁠> c) -⁠> (b -⁠> c) -⁠> Either a b -⁠> c` +#### `either :: (a -⁠> c) -⁠> (b -⁠> c) -⁠> Either a b -⁠> c` Takes two functions and an Either, and returns the result of applying the first function to the Left's value, if the Either @@ -1604,7 +1604,7 @@ Right's value, if the Either is a Right. '42' ``` -#### `lefts :: (Filterable f, Functor f) => f (Either a b) -⁠> f a` +#### `lefts :: (Filterable f, Functor f) => f (Either a b) -⁠> f a` Discards each element that is a Right, and unwraps each element that is a Left. @@ -1616,7 +1616,7 @@ See also [`rights`](#rights). ['foo', 'bar'] ``` -#### `rights :: (Filterable f, Functor f) => f (Either a b) -⁠> f b` +#### `rights :: (Filterable f, Functor f) => f (Either a b) -⁠> f b` Discards each element that is a Left, and unwraps each element that is a Right. @@ -1628,7 +1628,7 @@ See also [`lefts`](#lefts). [20, 10] ``` -#### `tagBy :: (a -⁠> Boolean) -⁠> a -⁠> Either a a` +#### `tagBy :: (a -⁠> Boolean) -⁠> a -⁠> Either a a` Takes a predicate and a value, and returns a Right of the value if it satisfies the predicate; a Left of the value otherwise. @@ -1641,7 +1641,7 @@ Left (0) Right (1) ``` -#### `encase :: (a -⁠> b) -⁠> a -⁠> Either Error b` +#### `encase :: (a -⁠> b) -⁠> a -⁠> Either Error b` Takes a function that may throw and returns a pure function. @@ -1653,7 +1653,7 @@ Right (['foo', 'bar', 'baz']) Left (new SyntaxError ('Unexpected end of JSON input')) ``` -#### `eitherToMaybe :: Either a b -⁠> Maybe b` +#### `eitherToMaybe :: Either a b -⁠> Maybe b` Converts an Either to a Maybe. A Left becomes Nothing; a Right becomes a Just. @@ -1670,7 +1670,7 @@ Just (42) ### Logic -#### `and :: Boolean -⁠> Boolean -⁠> Boolean` +#### `and :: Boolean -⁠> Boolean -⁠> Boolean` Boolean "and". @@ -1688,7 +1688,7 @@ false true ``` -#### `or :: Boolean -⁠> Boolean -⁠> Boolean` +#### `or :: Boolean -⁠> Boolean -⁠> Boolean` Boolean "or". @@ -1706,7 +1706,7 @@ true true ``` -#### `not :: Boolean -⁠> Boolean` +#### `not :: Boolean -⁠> Boolean` Boolean "not". @@ -1720,7 +1720,7 @@ true false ``` -#### `complement :: (a -⁠> Boolean) -⁠> a -⁠> Boolean` +#### `complement :: (a -⁠> Boolean) -⁠> a -⁠> Boolean` Takes a unary predicate and a value of any type, and returns the logical negation of applying the predicate to the value. @@ -1735,7 +1735,7 @@ true false ``` -#### `boolean :: a -⁠> a -⁠> Boolean -⁠> a` +#### `boolean :: a -⁠> a -⁠> Boolean -⁠> a` Case analysis for the `Boolean` type. `boolean (x) (y) (b)` evaluates to `x` if `b` is `false`; to `y` if `b` is `true`. @@ -1748,7 +1748,7 @@ to `x` if `b` is `false`; to `y` if `b` is `true`. 'yes' ``` -#### `ifElse :: (a -⁠> Boolean) -⁠> (a -⁠> b) -⁠> (a -⁠> b) -⁠> a -⁠> b` +#### `ifElse :: (a -⁠> Boolean) -⁠> (a -⁠> b) -⁠> (a -⁠> b) -⁠> a -⁠> b` Takes a unary predicate, a unary "if" function, a unary "else" function, and a value of any type, and returns the result of @@ -1766,7 +1766,7 @@ See also [`when`](#when) and [`unless`](#unless). 4 ``` -#### `when :: (a -⁠> Boolean) -⁠> (a -⁠> a) -⁠> a -⁠> a` +#### `when :: (a -⁠> Boolean) -⁠> (a -⁠> a) -⁠> a -⁠> a` Takes a unary predicate, a unary function, and a value of any type, and returns the result of applying the function to the value if the value @@ -1782,7 +1782,7 @@ See also [`unless`](#unless) and [`ifElse`](#ifElse). -1 ``` -#### `unless :: (a -⁠> Boolean) -⁠> (a -⁠> a) -⁠> a -⁠> a` +#### `unless :: (a -⁠> Boolean) -⁠> (a -⁠> a) -⁠> a -⁠> a` Takes a unary predicate, a unary function, and a value of any type, and returns the result of applying the function to the value if the value @@ -1800,7 +1800,7 @@ See also [`when`](#when) and [`ifElse`](#ifElse). ### Array -#### `array :: b -⁠> (a -⁠> Array a -⁠> b) -⁠> Array a -⁠> b` +#### `array :: b -⁠> (a -⁠> Array a -⁠> b) -⁠> Array a -⁠> b` Case analysis for the `Array a` type. @@ -1818,7 +1818,7 @@ Nothing Just ([2, 3]) ``` -#### `head :: Foldable f => f a -⁠> Maybe a` +#### `head :: Foldable f => f a -⁠> Maybe a` Returns Just the first element of the given structure if the structure contains at least one element; Nothing otherwise. @@ -1837,7 +1837,7 @@ Just (1) Nothing ``` -#### `last :: Foldable f => f a -⁠> Maybe a` +#### `last :: Foldable f => f a -⁠> Maybe a` Returns Just the last element of the given structure if the structure contains at least one element; Nothing otherwise. @@ -1856,7 +1856,7 @@ Just (3) Nothing ``` -#### `tail :: (Applicative f, Foldable f, Monoid (f a)) => f a -⁠> Maybe (f a)` +#### `tail :: (Applicative f, Foldable f, Monoid (f a)) => f a -⁠> Maybe (f a)` Returns Just all but the first of the given structure's elements if the structure contains at least one element; Nothing otherwise. @@ -1875,7 +1875,7 @@ Just (Cons (2) (Cons (3) (Nil))) Nothing ``` -#### `init :: (Applicative f, Foldable f, Monoid (f a)) => f a -⁠> Maybe (f a)` +#### `init :: (Applicative f, Foldable f, Monoid (f a)) => f a -⁠> Maybe (f a)` Returns Just all but the last of the given structure's elements if the structure contains at least one element; Nothing otherwise. @@ -1894,7 +1894,7 @@ Just (Cons (1) (Cons (2) (Nil))) Nothing ``` -#### `take :: (Applicative f, Foldable f, Monoid (f a)) => Integer -⁠> f a -⁠> Maybe (f a)` +#### `take :: (Applicative f, Foldable f, Monoid (f a)) => Integer -⁠> f a -⁠> Maybe (f a)` Returns Just the first N elements of the given structure if N is non-negative and less than or equal to the size of the structure; @@ -1917,7 +1917,7 @@ Nothing Just (Cons (1) (Cons (2) (Cons (3) (Nil)))) ``` -#### `drop :: (Applicative f, Foldable f, Monoid (f a)) => Integer -⁠> f a -⁠> Maybe (f a)` +#### `drop :: (Applicative f, Foldable f, Monoid (f a)) => Integer -⁠> f a -⁠> Maybe (f a)` Returns Just all but the first N elements of the given structure if N is non-negative and less than or equal to the size of the structure; @@ -1940,7 +1940,7 @@ Nothing Just (Cons (4) (Cons (5) (Nil))) ``` -#### `takeLast :: (Applicative f, Foldable f, Monoid (f a)) => Integer -⁠> f a -⁠> Maybe (f a)` +#### `takeLast :: (Applicative f, Foldable f, Monoid (f a)) => Integer -⁠> f a -⁠> Maybe (f a)` Returns Just the last N elements of the given structure if N is non-negative and less than or equal to the size of the structure; @@ -1963,7 +1963,7 @@ Nothing Just (Cons (2) (Cons (3) (Cons (4) (Nil)))) ``` -#### `dropLast :: (Applicative f, Foldable f, Monoid (f a)) => Integer -⁠> f a -⁠> Maybe (f a)` +#### `dropLast :: (Applicative f, Foldable f, Monoid (f a)) => Integer -⁠> f a -⁠> Maybe (f a)` Returns Just all but the last N elements of the given structure if N is non-negative and less than or equal to the size of the structure; @@ -1986,7 +1986,7 @@ Nothing Just (Cons (1) (Nil)) ``` -#### `takeWhile :: (a -⁠> Boolean) -⁠> Array a -⁠> Array a` +#### `takeWhile :: (a -⁠> Boolean) -⁠> Array a -⁠> Array a` Discards the first element that does not satisfy the predicate, and all subsequent elements. @@ -2001,7 +2001,7 @@ See also [`dropWhile`](#dropWhile). [] ``` -#### `dropWhile :: (a -⁠> Boolean) -⁠> Array a -⁠> Array a` +#### `dropWhile :: (a -⁠> Boolean) -⁠> Array a -⁠> Array a` Retains the first element that does not satisfy the predicate, and all subsequent elements. @@ -2016,7 +2016,7 @@ See also [`takeWhile`](#takeWhile). [3, 3, 3, 7, 6, 3, 5, 4] ``` -#### `size :: Foldable f => f a -⁠> Integer` +#### `size :: Foldable f => f a -⁠> NonNegativeInteger` Returns the number of elements of the given structure. @@ -2043,7 +2043,7 @@ Returns the number of elements of the given structure. 1 ``` -#### `all :: Foldable f => (a -⁠> Boolean) -⁠> f a -⁠> Boolean` +#### `all :: Foldable f => (a -⁠> Boolean) -⁠> f a -⁠> Boolean` Returns `true` [iff][] all the elements of the structure satisfy the predicate. @@ -2061,7 +2061,7 @@ true false ``` -#### `any :: Foldable f => (a -⁠> Boolean) -⁠> f a -⁠> Boolean` +#### `any :: Foldable f => (a -⁠> Boolean) -⁠> f a -⁠> Boolean` Returns `true` [iff][] any element of the structure satisfies the predicate. @@ -2079,7 +2079,7 @@ false true ``` -#### `none :: Foldable f => (a -⁠> Boolean) -⁠> f a -⁠> Boolean` +#### `none :: Foldable f => (a -⁠> Boolean) -⁠> f a -⁠> Boolean` Returns `true` [iff][] none of the elements of the structure satisfies the predicate. @@ -2105,7 +2105,7 @@ true false ``` -#### `append :: (Applicative f, Semigroup (f a)) => a -⁠> f a -⁠> f a` +#### `append :: (Applicative f, Semigroup (f a)) => a -⁠> f a -⁠> f a` Returns the result of appending the first argument to the second. @@ -2125,7 +2125,7 @@ Just ([1]) Just ([1, 2, 3]) ``` -#### `prepend :: (Applicative f, Semigroup (f a)) => a -⁠> f a -⁠> f a` +#### `prepend :: (Applicative f, Semigroup (f a)) => a -⁠> f a -⁠> f a` Returns the result of prepending the first argument to the second. @@ -2145,7 +2145,7 @@ Just ([1]) Just ([1, 2, 3]) ``` -#### `joinWith :: String -⁠> Array String -⁠> String` +#### `joinWith :: String -⁠> Array String -⁠> String` Joins the strings of the second argument separated by the first argument. @@ -2161,7 +2161,7 @@ See also [`splitOn`](#splitOn). 'foo:bar:baz' ``` -#### `elem :: (Setoid a, Foldable f) => a -⁠> f a -⁠> Boolean` +#### `elem :: (Setoid a, Foldable f) => a -⁠> f a -⁠> Boolean` Takes a value and a structure and returns `true` [iff][] the value is an element of the structure. @@ -2191,7 +2191,7 @@ false false ``` -#### `find :: Foldable f => (a -⁠> Boolean) -⁠> f a -⁠> Maybe a` +#### `find :: Foldable f => (a -⁠> Boolean) -⁠> f a -⁠> Maybe a` Takes a predicate and a structure and returns Just the leftmost element of the structure that satisfies the predicate; Nothing if there is no @@ -2207,7 +2207,7 @@ Just (-2) Nothing ``` -#### `foldMap :: (Monoid m, Foldable f) => TypeRep m -⁠> (a -⁠> m) -⁠> f a -⁠> m` +#### `foldMap :: (Monoid m, Foldable f) => TypeRep m -⁠> (a -⁠> m) -⁠> f a -⁠> m` Curried version of [`Z.foldMap`][]. Deconstructs a foldable by mapping every element to a monoid and concatenating the results. @@ -2220,7 +2220,7 @@ every element to a monoid and concatenating the results. [11, 12, 21, 22, 31, 32] ``` -#### `unfoldr :: (b -⁠> Maybe (Pair a b)) -⁠> b -⁠> Array a` +#### `unfoldr :: (b -⁠> Maybe (Pair a b)) -⁠> b -⁠> Array a` Takes a function and a seed value, and returns an array generated by applying the function repeatedly. The array is initially empty. The @@ -2237,7 +2237,7 @@ of the function should result in either: [1, 2, 4, 8, 16, 32, 64, 128, 256, 512] ``` -#### `range :: Integer -⁠> Integer -⁠> Array Integer` +#### `range :: Integer -⁠> Integer -⁠> Array Integer` Returns an array of consecutive integers starting with the first argument and ending with the second argument minus one. Returns `[]` if the second @@ -2254,7 +2254,7 @@ argument is less than or equal to the first argument. [] ``` -#### `groupBy :: (a -⁠> a -⁠> Boolean) -⁠> Array a -⁠> Array (Array a)` +#### `groupBy :: (a -⁠> a -⁠> Boolean) -⁠> Array a -⁠> Array (Array a)` Splits its array argument into an array of arrays of equal, adjacent elements. Equality is determined by the function @@ -2275,7 +2275,7 @@ Properties: [[2], [-3, 3, 3, 3], [4, -4], [4]] ``` -#### `reverse :: (Applicative f, Foldable f, Monoid (f a)) => f a -⁠> f a` +#### `reverse :: (Applicative f, Foldable f, Monoid (f a)) => f a -⁠> f a` Reverses the elements of the given structure. @@ -2290,7 +2290,7 @@ Cons (3) (Cons (2) (Cons (1) (Nil))) 'cba' ``` -#### `sort :: (Ord a, Applicative m, Foldable m, Monoid (m a)) => m a -⁠> m a` +#### `sort :: (Ord a, Applicative m, Foldable m, Monoid (m a)) => m a -⁠> m a` Performs a [stable sort][] of the elements of the given structure, using [`Z.lte`][] for comparisons. @@ -2309,7 +2309,7 @@ See also [`sortBy`](#sortBy). [Left (2), Left (4), Right (1), Right (3)] ``` -#### `sortBy :: (Ord b, Applicative m, Foldable m, Monoid (m a)) => (a -⁠> b) -⁠> m a -⁠> m a` +#### `sortBy :: (Ord b, Applicative m, Foldable m, Monoid (m a)) => (a -⁠> b) -⁠> m a -⁠> m a` Performs a [stable sort][] of the elements of the given structure, using [`Z.lte`][] to compare the values produced by applying the given function @@ -2352,7 +2352,7 @@ If descending order is desired, one may use [`Descending`][]: [121, 117, 116, 114, 110, 99, 97, 97, 83] ``` -#### `zip :: Array a -⁠> Array b -⁠> Array (Pair a b)` +#### `zip :: Array a -⁠> Array b -⁠> Array (Pair a b)` Returns an array of pairs of corresponding elements from the given arrays. The length of the resulting array is equal to the length of @@ -2368,7 +2368,7 @@ See also [`zipWith`](#zipWith). [Pair (1) (2), Pair (3) (4)] ``` -#### `zipWith :: (a -⁠> b -⁠> c) -⁠> Array a -⁠> Array b -⁠> Array c` +#### `zipWith :: (a -⁠> b -⁠> c) -⁠> Array a -⁠> Array b -⁠> Array c` Returns the result of combining, pairwise, the given arrays using the given binary function. The length of the resulting array is equal to the @@ -2386,7 +2386,7 @@ See also [`zip`](#zip). ### Object -#### `prop :: String -⁠> a -⁠> b` +#### `prop :: String -⁠> a -⁠> b` Takes a property name and an object with known properties and returns the value of the specified property. If for some reason the object @@ -2400,7 +2400,7 @@ For accessing string map values by key, use [`value`](#value) instead. 1 ``` -#### `props :: Array String -⁠> a -⁠> b` +#### `props :: Array String -⁠> a -⁠> b` Takes a property path (an array of property names) and an object with known structure and returns the value at the given path. If for some @@ -2414,7 +2414,7 @@ instead. 1 ``` -#### `get :: (Any -⁠> Boolean) -⁠> String -⁠> a -⁠> Maybe b` +#### `get :: (Any -⁠> Boolean) -⁠> String -⁠> a -⁠> Maybe b` Takes a predicate, a property name, and an object and returns Just the value of the specified object property if it exists and the value @@ -2439,7 +2439,7 @@ Just ([1, 2, 3]) Nothing ``` -#### `gets :: (Any -⁠> Boolean) -⁠> Array String -⁠> a -⁠> Maybe b` +#### `gets :: (Any -⁠> Boolean) -⁠> Array String -⁠> a -⁠> Maybe b` Takes a predicate, a property path (an array of property names), and an object and returns Just the value at the given path if such a path @@ -2466,7 +2466,7 @@ the same type. Formally, a value is a member of type `StrMap a` if its [type identifier][] is `'Object'` and the values of its enumerable own properties are all members of type `a`. -#### `value :: String -⁠> StrMap a -⁠> Maybe a` +#### `value :: String -⁠> StrMap a -⁠> Maybe a` Retrieve the value associated with the given key in the given string map. @@ -2486,7 +2486,7 @@ Just (2) Nothing ``` -#### `singleton :: String -⁠> a -⁠> StrMap a` +#### `singleton :: String -⁠> a -⁠> StrMap a` Takes a string and a value of any type, and returns a string map with a single entry (mapping the key to the value). @@ -2496,7 +2496,7 @@ a single entry (mapping the key to the value). {foo: 42} ``` -#### `insert :: String -⁠> a -⁠> StrMap a -⁠> StrMap a` +#### `insert :: String -⁠> a -⁠> StrMap a -⁠> StrMap a` Takes a string, a value of any type, and a string map, and returns a string map comprising all the entries of the given string map plus the @@ -2513,7 +2513,7 @@ function. {a: 4, b: 2} ``` -#### `remove :: String -⁠> StrMap a -⁠> StrMap a` +#### `remove :: String -⁠> StrMap a -⁠> StrMap a` Takes a string and a string map, and returns a string map comprising all the entries of the given string map except the one whose key matches the @@ -2530,7 +2530,7 @@ function. {} ``` -#### `keys :: StrMap a -⁠> Array String` +#### `keys :: StrMap a -⁠> Array String` Returns the keys of the given string map, in arbitrary order. @@ -2539,7 +2539,7 @@ Returns the keys of the given string map, in arbitrary order. ['a', 'b', 'c'] ``` -#### `values :: StrMap a -⁠> Array a` +#### `values :: StrMap a -⁠> Array a` Returns the values of the given string map, in arbitrary order. @@ -2548,7 +2548,7 @@ Returns the values of the given string map, in arbitrary order. [1, 2, 3] ``` -#### `pairs :: StrMap a -⁠> Array (Pair String a)` +#### `pairs :: StrMap a -⁠> Array (Pair String a)` Returns the key–value pairs of the given string map, in arbitrary order. @@ -2557,7 +2557,7 @@ Returns the key–value pairs of the given string map, in arbitrary order. [Pair ('a') (1), Pair ('b') (2), Pair ('c') (3)] ``` -#### `fromPairs :: Foldable f => f (Pair String a) -⁠> StrMap a` +#### `fromPairs :: Foldable f => f (Pair String a) -⁠> StrMap a` Returns a string map containing the key–value pairs specified by the given [Foldable][]. If a key appears in multiple pairs, the rightmost @@ -2573,7 +2573,7 @@ pair takes precedence. ### Number -#### `negate :: ValidNumber -⁠> ValidNumber` +#### `negate :: ValidNumber -⁠> ValidNumber` Negates its argument. @@ -2585,7 +2585,7 @@ Negates its argument. 42 ``` -#### `add :: FiniteNumber -⁠> FiniteNumber -⁠> FiniteNumber` +#### `add :: FiniteNumber -⁠> FiniteNumber -⁠> FiniteNumber` Returns the sum of two (finite) numbers. @@ -2594,7 +2594,7 @@ Returns the sum of two (finite) numbers. 2 ``` -#### `sum :: Foldable f => f FiniteNumber -⁠> FiniteNumber` +#### `sum :: Foldable f => f FiniteNumber -⁠> FiniteNumber` Returns the sum of the given array of (finite) numbers. @@ -2612,7 +2612,7 @@ Returns the sum of the given array of (finite) numbers. 0 ``` -#### `sub :: FiniteNumber -⁠> FiniteNumber -⁠> FiniteNumber` +#### `sub :: FiniteNumber -⁠> FiniteNumber -⁠> FiniteNumber` Takes a finite number `n` and returns the _subtract `n`_ function. @@ -2621,7 +2621,7 @@ Takes a finite number `n` and returns the _subtract `n`_ function. [0, 1, 2] ``` -#### `mult :: FiniteNumber -⁠> FiniteNumber -⁠> FiniteNumber` +#### `mult :: FiniteNumber -⁠> FiniteNumber -⁠> FiniteNumber` Returns the product of two (finite) numbers. @@ -2630,7 +2630,7 @@ Returns the product of two (finite) numbers. 8 ``` -#### `product :: Foldable f => f FiniteNumber -⁠> FiniteNumber` +#### `product :: Foldable f => f FiniteNumber -⁠> FiniteNumber` Returns the product of the given array of (finite) numbers. @@ -2648,7 +2648,7 @@ Returns the product of the given array of (finite) numbers. 1 ``` -#### `div :: NonZeroFiniteNumber -⁠> FiniteNumber -⁠> FiniteNumber` +#### `div :: NonZeroFiniteNumber -⁠> FiniteNumber -⁠> FiniteNumber` Takes a non-zero finite number `n` and returns the _divide by `n`_ function. @@ -2658,7 +2658,7 @@ function. [0, 0.5, 1, 1.5] ``` -#### `pow :: FiniteNumber -⁠> FiniteNumber -⁠> FiniteNumber` +#### `pow :: FiniteNumber -⁠> FiniteNumber -⁠> FiniteNumber` Takes a finite number `n` and returns the _power of `n`_ function. @@ -2670,7 +2670,7 @@ Takes a finite number `n` and returns the _power of `n`_ function. [1, 2, 3, 4, 5] ``` -#### `mean :: Foldable f => f FiniteNumber -⁠> Maybe FiniteNumber` +#### `mean :: Foldable f => f FiniteNumber -⁠> Maybe FiniteNumber` Returns the mean of the given array of (finite) numbers. @@ -2690,7 +2690,7 @@ Nothing ### Integer -#### `even :: Integer -⁠> Boolean` +#### `even :: Integer -⁠> Boolean` Returns `true` if the given integer is even; `false` if it is odd. @@ -2702,7 +2702,7 @@ true false ``` -#### `odd :: Integer -⁠> Boolean` +#### `odd :: Integer -⁠> Boolean` Returns `true` if the given integer is odd; `false` if it is even. @@ -2716,7 +2716,7 @@ false ### Parse -#### `parseDate :: String -⁠> Maybe ValidDate` +#### `parseDate :: String -⁠> Maybe ValidDate` Takes a string `s` and returns `Just (new Date (s))` if `new Date (s)` evaluates to a [`ValidDate`][ValidDate] value; Nothing otherwise. @@ -2739,7 +2739,7 @@ Just (new Date ('2011-01-19T17:40:00.000Z')) Nothing ``` -#### `parseFloat :: String -⁠> Maybe Number` +#### `parseFloat :: String -⁠> Maybe Number` Takes a string and returns Just the number represented by the string if it does in fact represent a number; Nothing otherwise. @@ -2752,7 +2752,7 @@ Just (-123.45) Nothing ``` -#### `parseInt :: Radix -⁠> String -⁠> Maybe Integer` +#### `parseInt :: Radix -⁠> String -⁠> Maybe Integer` Takes a radix (an integer between 2 and 36 inclusive) and a string, and returns Just the number represented by the string if it does in @@ -2774,7 +2774,7 @@ Just (255) Nothing ``` -#### `parseJson :: (Any -⁠> Boolean) -⁠> String -⁠> Maybe a` +#### `parseJson :: (Any -⁠> Boolean) -⁠> String -⁠> Maybe a` Takes a predicate and a string that may or may not be valid JSON, and returns Just the result of applying `JSON.parse` to the string *if* the @@ -2796,7 +2796,7 @@ Just ([1, 2, 3]) ### RegExp -#### `regex :: RegexFlags -⁠> String -⁠> RegExp` +#### `regex :: RegexFlags -⁠> String -⁠> RegExp` Takes a [RegexFlags][] and a pattern, and returns a RegExp. @@ -2805,7 +2805,7 @@ Takes a [RegexFlags][] and a pattern, and returns a RegExp. /:\d+:/g ``` -#### `regexEscape :: String -⁠> String` +#### `regexEscape :: String -⁠> String` Takes a string that may contain regular expression metacharacters, and returns a string with those metacharacters escaped. @@ -2820,7 +2820,7 @@ Properties: '\\-=\\*\\{XYZ\\}\\*=\\-' ``` -#### `test :: RegExp -⁠> String -⁠> Boolean` +#### `test :: RegExp -⁠> String -⁠> Boolean` Takes a pattern and a string, and returns `true` [iff][] the pattern matches the string. @@ -2833,7 +2833,7 @@ true false ``` -#### `match :: NonGlobalRegExp -⁠> String -⁠> Maybe { match :: String, groups :: Array (Maybe String) }` +#### `match :: NonGlobalRegExp -⁠> String -⁠> Maybe { match :: String, groups :: Array (Maybe String) }` Takes a pattern and a string, and returns Just a match record if the pattern matches the string; Nothing otherwise. @@ -2857,7 +2857,7 @@ Just ({match: 'goodbye', groups: [Just ('good')]}) Just ({match: 'bye', groups: [Nothing]}) ``` -#### `matchAll :: GlobalRegExp -⁠> String -⁠> Array { match :: String, groups :: Array (Maybe String) }` +#### `matchAll :: GlobalRegExp -⁠> String -⁠> Array { match :: String, groups :: Array (Maybe String) }` Takes a pattern and a string, and returns an array of match records. @@ -2878,7 +2878,7 @@ See also [`match`](#match). ### String -#### `toUpper :: String -⁠> String` +#### `toUpper :: String -⁠> String` Returns the upper-case equivalent of its argument. @@ -2889,7 +2889,7 @@ See also [`toLower`](#toLower). 'ABC DEF 123' ``` -#### `toLower :: String -⁠> String` +#### `toLower :: String -⁠> String` Returns the lower-case equivalent of its argument. @@ -2900,7 +2900,7 @@ See also [`toUpper`](#toUpper). 'abc def 123' ``` -#### `trim :: String -⁠> String` +#### `trim :: String -⁠> String` Strips leading and trailing whitespace characters. @@ -2909,7 +2909,7 @@ Strips leading and trailing whitespace characters. 'foo bar' ``` -#### `stripPrefix :: String -⁠> String -⁠> Maybe String` +#### `stripPrefix :: String -⁠> String -⁠> Maybe String` Returns Just the portion of the given string (the second argument) left after removing the given prefix (the first argument) if the string starts @@ -2925,7 +2925,7 @@ Just ('sanctuary.js.org') Nothing ``` -#### `stripSuffix :: String -⁠> String -⁠> Maybe String` +#### `stripSuffix :: String -⁠> String -⁠> Maybe String` Returns Just the portion of the given string (the second argument) left after removing the given suffix (the first argument) if the string ends @@ -2941,7 +2941,7 @@ Just ('README') Nothing ``` -#### `words :: String -⁠> Array String` +#### `words :: String -⁠> Array String` Takes a string and returns the array of words the string contains (words are delimited by whitespace characters). @@ -2953,7 +2953,7 @@ See also [`unwords`](#unwords). ['foo', 'bar', 'baz'] ``` -#### `unwords :: Array String -⁠> String` +#### `unwords :: Array String -⁠> String` Takes an array of words and returns the result of joining the words with separating spaces. @@ -2965,7 +2965,7 @@ See also [`words`](#words). 'foo bar baz' ``` -#### `lines :: String -⁠> Array String` +#### `lines :: String -⁠> Array String` Takes a string and returns the array of lines the string contains (lines are delimited by newlines: `'\n'` or `'\r\n'` or `'\r'`). @@ -2978,7 +2978,7 @@ See also [`unlines`](#unlines). ['foo', 'bar', 'baz'] ``` -#### `unlines :: Array String -⁠> String` +#### `unlines :: Array String -⁠> String` Takes an array of lines and returns the result of joining the lines after appending a terminating line feed (`'\n'`) to each. @@ -2990,7 +2990,7 @@ See also [`lines`](#lines). 'foo\nbar\nbaz\n' ``` -#### `splitOn :: String -⁠> String -⁠> Array String` +#### `splitOn :: String -⁠> String -⁠> Array String` Returns the substrings of its second argument separated by occurrences of its first argument. @@ -3002,7 +3002,7 @@ See also [`joinWith`](#joinWith) and [`splitOnRegex`](#splitOnRegex). ['foo', 'bar', 'baz'] ``` -#### `splitOnRegex :: GlobalRegExp -⁠> String -⁠> Array String` +#### `splitOnRegex :: GlobalRegExp -⁠> String -⁠> Array String` Takes a pattern and a string, and returns the result of splitting the string at every non-overlapping occurrence of the pattern. @@ -3036,13 +3036,13 @@ See also [`splitOn`](#splitOn). [Haskell]: https://www.haskell.org/ [Kleisli]: https://en.wikipedia.org/wiki/Kleisli_category [Maybe]: #maybe-type -[Nullable]: https://github.com/sanctuary-js/sanctuary-def/tree/v0.20.0#Nullable +[Nullable]: https://github.com/sanctuary-js/sanctuary-def/tree/v0.20.1#Nullable [PureScript]: http://www.purescript.org/ [Ramda]: http://ramdajs.com/ -[RegexFlags]: https://github.com/sanctuary-js/sanctuary-def/tree/v0.20.0#RegexFlags +[RegexFlags]: https://github.com/sanctuary-js/sanctuary-def/tree/v0.20.1#RegexFlags [Semigroupoid]: https://github.com/fantasyland/fantasy-land/tree/v4.0.1#semigroupoid -[ValidDate]: https://github.com/sanctuary-js/sanctuary-def/tree/v0.20.0#ValidDate -[`$.test`]: https://github.com/sanctuary-js/sanctuary-def/tree/v0.20.0#test +[ValidDate]: https://github.com/sanctuary-js/sanctuary-def/tree/v0.20.1#ValidDate +[`$.test`]: https://github.com/sanctuary-js/sanctuary-def/tree/v0.20.1#test [`Descending`]: https://github.com/sanctuary-js/sanctuary-descending/tree/v1.2.0#Descending [`R.__`]: http://ramdajs.com/docs/#__ [`R.bind`]: http://ramdajs.com/docs/#bind @@ -3089,7 +3089,7 @@ See also [`splitOn`](#splitOn). [ramda/ramda#683]: https://github.com/ramda/ramda/issues/683 [ramda/ramda#1413]: https://github.com/ramda/ramda/issues/1413 [ramda/ramda#1419]: https://github.com/ramda/ramda/pull/1419 -[sanctuary-def]: https://github.com/sanctuary-js/sanctuary-def/tree/v0.20.0 +[sanctuary-def]: https://github.com/sanctuary-js/sanctuary-def/tree/v0.20.1 [sanctuary-either]: https://github.com/sanctuary-js/sanctuary-either/tree/v1.2.0 [sanctuary-maybe]: https://github.com/sanctuary-js/sanctuary-maybe/tree/v1.2.0 [sanctuary-pair]: https://github.com/sanctuary-js/sanctuary-pair/tree/v1.2.0 diff --git a/package.json b/package.json index a77e7940..7e9534bd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sanctuary", - "version": "2.0.0", + "version": "2.0.1", "description": "Refuge from unsafe JavaScript", "license": "MIT", "repository": {