From 59c71d92374eb976fc6e5b88970b0c37e60054d0 Mon Sep 17 00:00:00 2001 From: David Chambers Date: Wed, 23 Sep 2015 15:44:24 -0700 Subject: [PATCH] Version 0.7.1 --- README.md | 150 +++++++++++++++++++++++++-------------------------- bower.json | 2 +- package.json | 2 +- 3 files changed, 77 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index 9130975b..3425c256 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ For example: ### Classify -

is :: TypeRep a -> b -> Boolean

+

is :: TypeRep a -> b -> Boolean

Takes a [type representative](#type-representatives) and a value of any type and returns `true` if the given value is of the specified @@ -113,7 +113,7 @@ false ### Combinator -

I :: a -> a

+

I :: a -> a

The I combinator. Returns its argument. Equivalent to Haskell's `id` function. @@ -123,7 +123,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. @@ -138,7 +138,7 @@ Haskell's `const` function. ### Composition -

compose :: (b -> c) -> (a -> b) -> a -> c

+

compose :: (b -> c) -> (a -> b) -> a -> c

Takes two functions assumed to be unary and a value of any type, and returns the result of applying the first function to the result @@ -154,7 +154,7 @@ See also [`pipe`](#pipe). 10 ``` -

pipe :: [(a -> b), (b -> c), ..., (m -> n)] -> a -> n

+

pipe :: [(a -> b), (b -> c), ..., (m -> n)] -> a -> n

Takes a list of functions assumed to be unary and a value of any type, and returns the result of applying the sequence of transformations to @@ -170,7 +170,7 @@ See also [`meld`](#meld). 9 ``` -

meld :: [** -> *] -> (* -> * -> ... -> *)

+

meld :: [** -> *] -> (* -> * -> ... -> *)

Takes a list of non-nullary functions and returns a curried function whose arity is one greater than the sum of the arities of the given @@ -199,7 +199,7 @@ See also [`pipe`](#pipe). ### Maybe type -

Maybe :: TypeRep Maybe

+

Maybe :: TypeRep Maybe

The Maybe type represents optional values: a value of type `Maybe a` is either a Just whose value is of type `a` or a Nothing (with no value). @@ -207,7 +207,7 @@ either a Just whose value is of type `a` or a Nothing (with no value). The Maybe type satisfies the [Monoid][], [Monad][], [Foldable][], and [Extend][] specifications. -

Maybe.empty :: -> Maybe a

+

Maybe.empty :: -> Maybe a

Returns a Nothing. @@ -216,7 +216,7 @@ Returns a Nothing. Nothing() ``` -

Maybe.of :: a -> Maybe a

+

Maybe.of :: a -> Maybe a

Takes a value of any type and returns a Just with the given value. @@ -225,7 +225,7 @@ Takes a value of any type and returns a Just with the given value. Just(42) ``` -

Maybe#ap :: Maybe (a -> b) ~> Maybe a -> Maybe b

+

Maybe#ap :: Maybe (a -> b) ~> Maybe a -> Maybe b

Takes a value of type `Maybe a` and returns a Nothing unless `this` is a Just *and* the argument is a Just, in which case it returns a @@ -243,7 +243,7 @@ Nothing() Just(43) ``` -

Maybe#chain :: Maybe a ~> (a -> Maybe b) -> Maybe b

+

Maybe#chain :: Maybe a ~> (a -> Maybe b) -> Maybe b

Takes a function and returns `this` if `this` is a Nothing; otherwise it returns the result of applying the function to this Just's value. @@ -259,7 +259,7 @@ Nothing() Just(12.34) ``` -

Maybe#concat :: Maybe a ~> Maybe a -> Maybe a

+

Maybe#concat :: Maybe a ~> Maybe a -> Maybe a

Returns the result of concatenating two Maybe values of the same type. `a` must have a [Semigroup][] (indicated by the presence of a `concat` @@ -288,7 +288,7 @@ Just([1, 2, 3]) Just([1, 2, 3]) ``` -

Maybe#empty :: Maybe a ~> Maybe a

+

Maybe#empty :: Maybe a ~> Maybe a

Returns a Nothing. @@ -297,7 +297,7 @@ Returns a Nothing. Nothing() ``` -

Maybe#equals :: Maybe a ~> b -> Boolean

+

Maybe#equals :: Maybe a ~> b -> Boolean

Takes a value of any type and returns `true` if: @@ -323,7 +323,7 @@ false false ``` -

Maybe#extend :: Maybe a ~> (Maybe a -> a) -> Maybe a

+

Maybe#extend :: Maybe a ~> (Maybe a -> a) -> Maybe a

Takes a function and returns `this` if `this` is a Nothing; otherwise it returns a Just whose value is the result of applying the function to @@ -337,7 +337,7 @@ Nothing() Just(43) ``` -

Maybe#filter :: Maybe a ~> (a -> Boolean) -> Maybe a

+

Maybe#filter :: Maybe a ~> (a -> Boolean) -> Maybe a

Takes a predicate and returns `this` if `this` is a Just whose value satisfies the predicate; Nothing otherwise. @@ -350,7 +350,7 @@ Just(42) Nothing() ``` -

Maybe#map :: Maybe a ~> (a -> b) -> Maybe b

+

Maybe#map :: Maybe a ~> (a -> b) -> Maybe b

Takes a function and returns `this` if `this` is a Nothing; otherwise it returns a Just whose value is the result of applying the function to @@ -364,7 +364,7 @@ Nothing() Just(6) ``` -

Maybe#of :: Maybe a ~> b -> Maybe b

+

Maybe#of :: Maybe a ~> b -> Maybe b

Takes a value of any type and returns a Just with the given value. @@ -373,7 +373,7 @@ Takes a value of any type and returns a Just with the given value. Just(42) ``` -

Maybe#reduce :: Maybe a ~> (b -> a -> b) -> b -> b

+

Maybe#reduce :: Maybe a ~> (b -> a -> b) -> b -> b

Takes a function and an initial value of any type, and returns: @@ -390,7 +390,7 @@ Takes a function and an initial value of any type, and returns: 15 ``` -

Maybe#toBoolean :: Maybe a ~> Boolean

+

Maybe#toBoolean :: Maybe a ~> Boolean

Returns `false` if `this` is a Nothing; `true` if `this` is a Just. @@ -402,7 +402,7 @@ false true ``` -

Maybe#toString :: Maybe a ~> String

+

Maybe#toString :: Maybe a ~> String

Returns the string representation of the Maybe. @@ -414,12 +414,12 @@ Returns the string representation of the Maybe. "Just([1, 2, 3])" ``` -

Maybe#type :: TypeRep Maybe

+

Maybe#type :: TypeRep Maybe

A reference to the Maybe type. Useful for determining whether two values such as `S.Nothing()` and `S.Just(42)` are of the same type. -

Nothing :: -> Maybe a

+

Nothing :: -> Maybe a

Returns a Nothing. Though this is a constructor function the `new` keyword needn't be used. @@ -429,7 +429,7 @@ keyword needn't be used. Nothing() ``` -

Just :: a -> Maybe a

+

Just :: a -> Maybe a

Takes a value of any type and returns a Just with the given value. Though this is a constructor function the `new` keyword needn't be @@ -440,7 +440,7 @@ used. Just(42) ``` -

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. @@ -453,7 +453,7 @@ if the Maybe is a Just; the default value otherwise. 0 ``` -

toMaybe :: a? -> Maybe a

+

toMaybe :: a? -> Maybe a

Takes a value and returns Nothing if the value is null or undefined; Just the value otherwise. @@ -466,7 +466,7 @@ Nothing() Just(42) ``` -

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 @@ -480,7 +480,7 @@ the Just's value. Otherwise, the first argument is returned. 0 ``` -

catMaybes :: [Maybe a] -> [a]

+

catMaybes :: [Maybe a] -> [a]

Takes a list of Maybes and returns a list containing each Just's value. @@ -489,7 +489,7 @@ Takes a list of Maybes and returns a list containing each Just's value. ["foo", "baz"] ``` -

mapMaybe :: (a -> Maybe b) -> [a] -> [b]

+

mapMaybe :: (a -> Maybe b) -> [a] -> [b]

Takes a function and a list, applies the function to each element of the list, and returns a list of "successful" results. If the result of @@ -504,7 +504,7 @@ In general terms, `mapMaybe` filters a list while mapping over it. [1, 4] ``` -

encase :: (* -> a) -> (* -> Maybe a)

+

encase :: (* -> a) -> (* -> Maybe a)

Takes a function `f` which may throw and returns a curried function `g` which will not throw. The result of applying `g` is determined by @@ -523,7 +523,7 @@ Nothing() ### Either type -

Either :: TypeRep Either

+

Either :: TypeRep Either

The Either type represents values with two possibilities: a value of type `Either a b` is either a Left whose value is of type `a` or a Right whose @@ -532,7 +532,7 @@ value is of type `b`. The Either type satisfies the [Semigroup][], [Monad][], and [Extend][] specifications. -

Either.of :: b -> Either a b

+

Either.of :: b -> Either a b

Takes a value of any type and returns a Right with the given value. @@ -541,7 +541,7 @@ Takes a value of any type and returns a Right with the given value. Right(42) ``` -

Either#ap :: Either a (b -> c) ~> Either a b -> Either a c

+

Either#ap :: Either a (b -> c) ~> Either a b -> Either a c

Takes a value of type `Either a b` and returns a Left unless `this` is a Right *and* the argument is a Right, in which case it returns @@ -559,7 +559,7 @@ Left("Cannot divide by zero") Right(43) ``` -

Either#chain :: Either a b ~> (b -> Either a c) -> Either a c

+

Either#chain :: Either a b ~> (b -> Either a c) -> Either a c

Takes a function and returns `this` if `this` is a Left; otherwise it returns the result of applying the function to this Right's value. @@ -578,7 +578,7 @@ Left("Cannot represent square root of negative number") Right(5) ``` -

Either#concat :: Either a b ~> Either a b -> Either a b

+

Either#concat :: Either a b ~> Either a b -> Either a b

Returns the result of concatenating two Either values of the same type. `a` must have a [Semigroup][] (indicated by the presence of a `concat` @@ -608,7 +608,7 @@ Right([1, 2, 3]) Right([1, 2, 3]) ``` -

Either#equals :: Either a b ~> c -> Boolean

+

Either#equals :: Either a b ~> c -> Boolean

Takes a value of any type and returns `true` if: @@ -629,7 +629,7 @@ false false ``` -

Either#extend :: Either a b ~> (Either a b -> b) -> Either a b

+

Either#extend :: Either a b ~> (Either a b -> b) -> Either a b

Takes a function and returns `this` if `this` is a Left; otherwise it returns a Right whose value is the result of applying the function to @@ -643,7 +643,7 @@ Left("Cannot divide by zero") Right(43) ``` -

Either#map :: Either a b ~> (b -> c) -> Either a c

+

Either#map :: Either a b ~> (b -> c) -> Either a c

Takes a function and returns `this` if `this` is a Left; otherwise it returns a Right whose value is the result of applying the function to @@ -657,7 +657,7 @@ Left("Cannot divide by zero") Right(6) ``` -

Either#of :: Either a b ~> b -> Either a b

+

Either#of :: Either a b ~> b -> Either a b

Takes a value of any type and returns a Right with the given value. @@ -666,7 +666,7 @@ Takes a value of any type and returns a Right with the given value. Right(42) ``` -

Either#toBoolean :: Either a b ~> Boolean

+

Either#toBoolean :: Either a b ~> Boolean

Returns `false` if `this` is a Left; `true` if `this` is a Right. @@ -678,7 +678,7 @@ false true ``` -

Either#toString :: Either a b ~> String

+

Either#toString :: Either a b ~> String

Returns the string representation of the Either. @@ -690,13 +690,13 @@ Returns the string representation of the Either. "Right([1, 2, 3])" ``` -

Either#type :: TypeRep Either

+

Either#type :: TypeRep Either

A reference to the Either type. Useful for determining whether two values such as `S.Left('Cannot divide by zero')` and `S.Right(42)` are of the same type. -

Left :: a -> Either a b

+

Left :: a -> Either a b

Takes a value of any type and returns a Left with the given value. Though this is a constructor function the `new` keyword needn't be @@ -707,7 +707,7 @@ used. Left("Cannot divide by zero") ``` -

Right :: b -> Either a b

+

Right :: b -> Either a b

Takes a value of any type and returns a Right with the given value. Though this is a constructor function the `new` keyword needn't be @@ -718,7 +718,7 @@ used. Right(42) ``` -

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 @@ -733,7 +733,7 @@ Right's value, if the Either is a Right. "42" ``` -

encaseEither :: (Error -> a) -> (* -> b) -> (* -> Either a b)

+

encaseEither :: (Error -> a) -> (* -> b) -> (* -> Either a b)

Takes two functions, `f` and `g`, the second of which may throw, and returns a curried function of the same arity as `g` which will @@ -756,7 +756,7 @@ Left(RangeError: Invalid array length) Left("Invalid array length") ``` -

maybeToEither :: a -> Maybe b -> Either a b

+

maybeToEither :: a -> Maybe b -> Either a b

Takes a value of any type and a Maybe, and returns an Either. If the second argument is a Nothing, a Left containing the first @@ -773,7 +773,7 @@ Right(42) ### Control -

and :: a -> a -> a

+

and :: a -> a -> a

Takes two values of the same type and returns the second value if the first is "true"; the first value otherwise. An array is @@ -789,7 +789,7 @@ Just(2) Nothing() ``` -

or :: a -> a -> a

+

or :: a -> a -> a

Takes two values of the same type and returns the first value if it is "true"; the second value otherwise. An array is considered "true" @@ -804,7 +804,7 @@ Just(1) Just(3) ``` -

xor :: a -> a -> a

+

xor :: a -> a -> a

Takes two values of the same type and returns the "true" value if one value is "true" and the other is "false"; otherwise it @@ -823,7 +823,7 @@ Nothing() ### List -

slice :: Integer -> Integer -> [a] -> Maybe [a]

+

slice :: Integer -> Integer -> [a] -> Maybe [a]

Returns Just a list containing the elements from the supplied list from a beginning index (inclusive) to an end index (exclusive). @@ -852,7 +852,7 @@ Nothing() Just("nana") ``` -

at :: Integer -> [a] -> Maybe a

+

at :: Integer -> [a] -> Maybe a

Takes an index and a list and returns Just the element of the list at the index if the index is within the list's bounds; Nothing otherwise. @@ -869,7 +869,7 @@ Nothing() Just("d") ``` -

head :: [a] -> Maybe a

+

head :: [a] -> Maybe a

Takes a list and returns Just the first element of the list if the list contains at least one element; Nothing if the list is empty. @@ -882,7 +882,7 @@ Just(1) Nothing() ``` -

last :: [a] -> Maybe a

+

last :: [a] -> Maybe a

Takes a list and returns Just the last element of the list if the list contains at least one element; Nothing if the list is empty. @@ -895,7 +895,7 @@ Just(3) Nothing() ``` -

tail :: [a] -> Maybe [a]

+

tail :: [a] -> Maybe [a]

Takes a list and returns Just a list containing all but the first of the list's elements if the list contains at least one element; @@ -909,7 +909,7 @@ Just([2, 3]) Nothing() ``` -

init :: [a] -> Maybe [a]

+

init :: [a] -> Maybe [a]

Takes a list and returns Just a list containing all but the last of the list's elements if the list contains at least one element; @@ -923,7 +923,7 @@ Just([1, 2]) Nothing() ``` -

take :: Integer -> [a] -> Maybe [a]

+

take :: Integer -> [a] -> Maybe [a]

Returns Just the first N elements of the given collection if N is greater than or equal to zero and less than or equal to the length @@ -941,7 +941,7 @@ Just("abcd") Nothing() ``` -

takeLast :: Integer -> [a] -> Maybe [a]

+

takeLast :: Integer -> [a] -> Maybe [a]

Returns Just the last N elements of the given collection if N is greater than or equal to zero and less than or equal to the length @@ -959,7 +959,7 @@ Just("defg") Nothing() ``` -

drop :: Integer -> [a] -> Maybe [a]

+

drop :: Integer -> [a] -> Maybe [a]

Returns Just all but the first N elements of the given collection if N is greater than or equal to zero and less than or equal to the @@ -977,7 +977,7 @@ Just("efg") Nothing() ``` -

dropLast :: Integer -> [a] -> Maybe [a]

+

dropLast :: Integer -> [a] -> Maybe [a]

Returns Just all but the last N elements of the given collection if N is greater than or equal to zero and less than or equal to the @@ -995,7 +995,7 @@ Just("abc") Nothing() ``` -

find :: (a -> Boolean) -> [a] -> Maybe a

+

find :: (a -> Boolean) -> [a] -> Maybe a

Takes a predicate and a list and returns Just the leftmost element of the list which satisfies the predicate; Nothing if none of the list's @@ -1009,7 +1009,7 @@ Just(-2) Nothing() ``` -

indexOf :: a -> [a] -> Maybe Integer

+

indexOf :: a -> [a] -> Maybe Integer

Takes a value of any type and a list, and returns Just the index of the first occurrence of the value in the list, if applicable; @@ -1033,7 +1033,7 @@ Just(1) Nothing() ``` -

lastIndexOf :: a -> [a] -> Maybe Integer

+

lastIndexOf :: a -> [a] -> Maybe Integer

Takes a value of any type and a list, and returns Just the index of the last occurrence of the value in the list, if applicable; @@ -1057,7 +1057,7 @@ Just(3) Nothing() ``` -

pluck :: TypeRep a -> String -> [Accessible] -> [Maybe a]

+

pluck :: TypeRep a -> String -> [Accessible] -> [Maybe a]

Takes a [type representative](#type-representatives), a property name, and a list of objects and returns a list of equal length. Each element @@ -1074,7 +1074,7 @@ See also [`get`](#get). ### Object -

get :: TypeRep a -> String -> Accessible -> Maybe a

+

get :: TypeRep a -> String -> Accessible -> Maybe a

Takes a [type representative](#type-representatives), a property name, and an object and returns Just the value of the specified object @@ -1097,7 +1097,7 @@ Nothing() Nothing() ``` -

gets :: TypeRep a -> [String] -> Accessible -> Maybe a

+

gets :: TypeRep a -> [String] -> Accessible -> Maybe a

Takes a [type representative](#type-representatives), a list of property names, and an object and returns Just the value at the path specified by @@ -1119,7 +1119,7 @@ Nothing() ### Parse -

parseDate :: String -> Maybe Date

+

parseDate :: String -> Maybe Date

Takes a string and returns Just the date represented by the string if it does in fact represent a date; Nothing otherwise. @@ -1132,7 +1132,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. @@ -1145,7 +1145,7 @@ Just(-123.45) Nothing() ``` -

parseInt :: Integer -> String -> Maybe Integer

+

parseInt :: Integer -> 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 @@ -1167,7 +1167,7 @@ Just(255) Nothing() ``` -

parseJson :: String -> Maybe *

+

parseJson :: String -> Maybe *

Takes a string which may or may not be valid JSON, and returns Just the result of applying `JSON.parse` to the string if valid; Nothing @@ -1183,7 +1183,7 @@ Nothing() ### RegExp -

match :: RegExp -> String -> Maybe [Maybe String]

+

match :: RegExp -> String -> Maybe [Maybe String]

Takes a pattern and a string, and returns Just a list of matches if the pattern matches the string; Nothing otherwise. Each match @@ -1200,7 +1200,7 @@ Just([Just("bye"), Nothing()]) ### String -

words :: String -> [String]

+

words :: String -> [String]

Takes a string and returns the list of words the string contains (words are delimited by whitespace characters). @@ -1212,7 +1212,7 @@ See also [`unwords`](#unwords). ["foo", "bar", "baz"] ``` -

unwords :: [String] -> String

+

unwords :: [String] -> String

Takes a list of words and returns the result of joining the words with separating spaces. @@ -1224,7 +1224,7 @@ See also [`words`](#words). "foo bar baz" ``` -

lines :: String -> [String]

+

lines :: String -> [String]

Takes a string and returns the list of lines the string contains (lines are delimited by newlines: `'\n'` or `'\r\n'` or `'\r'`). @@ -1237,7 +1237,7 @@ See also [`unlines`](#unlines). ["foo", "bar", "baz"] ``` -

unlines :: [String] -> String

+

unlines :: [String] -> String

Takes a list of lines and returns the result of joining the lines after appending a terminating line feed (`'\n'`) to each. diff --git a/bower.json b/bower.json index 8beb7c99..5dcf029c 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "sanctuary", - "version": "0.7.0", + "version": "0.7.1", "description": "Refuge from unsafe JavaScript", "license": "MIT", "repository": { diff --git a/package.json b/package.json index 1843f5e4..448c5a5d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sanctuary", - "version": "0.7.0", + "version": "0.7.1", "description": "Refuge from unsafe JavaScript", "license": "MIT", "repository": {