git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #969 from purescript/hide-refeq
a60f34aGary Burgess
prelude/prelude.purs+52−52
@@ -20,7 +20,7 @@ module Prelude
20 , negate
20 , negate
21 , DivisionRing
21 , DivisionRing
22 , Num
22 , Num
23− , Eq, (==), (/=), refEq, refIneq
23+ , Eq, (==), (/=)
24 , Ord, Ordering(..), compare, (<), (>), (<=), (>=)
24 , Ord, Ordering(..), compare, (<), (>), (<=), (>=)
25 , Bits, (.&.), (.|.), (.^.), shl, shr, zshr, complement
25 , Bits, (.&.), (.|.), (.^.), shl, shr, zshr, complement
26 , BoolLike, (&&), (||)
26 , BoolLike, (&&), (||)
@@ -170,7 +170,7 @@ module Prelude
170
170
171 -- | The `Show` type class represents those types which can be converted into a human-readable `String` representation.
171 -- | The `Show` type class represents those types which can be converted into a human-readable `String` representation.
172 -- |
172 -- |
173− -- | While not required, it is recommended that for any expression `x`, the string `show x` be executable PureScript code
173+ -- | While not required, it is recommended that for any expression `x`, the string `show x` be executable PureScript code
174 -- | which evaluates to the same value as the expression `x`.
174 -- | which evaluates to the same value as the expression `x`.
175 class Show a where
175 class Show a where
176 show :: a -> String
176 show :: a -> String
@@ -222,7 +222,7 @@ module Prelude
222 infixl 1 <#>
222 infixl 1 <#>
223
223
224 -- | A `Functor` is a type constructor which supports a mapping operation `(<$>)`.
224 -- | A `Functor` is a type constructor which supports a mapping operation `(<$>)`.
225− -- |
225+ -- |
226 -- | `(<$>)` can be used to turn functions `a -> b` into functions `f a -> f b` whose argument and return
226 -- | `(<$>)` can be used to turn functions `a -> b` into functions `f a -> f b` whose argument and return
227 -- | types use the type constructor `f` to represent some computational context.
227 -- | types use the type constructor `f` to represent some computational context.
228 -- |
228 -- |
@@ -235,14 +235,14 @@ module Prelude
235 (<$>) :: forall a b. (a -> b) -> f a -> f b
235 (<$>) :: forall a b. (a -> b) -> f a -> f b
236
236
237 -- | `(<#>)` is `(<$>)` with its arguments reversed. For example:
237 -- | `(<#>)` is `(<$>)` with its arguments reversed. For example:
238− -- |
238+ -- |
239 -- | ```purescript
239 -- | ```purescript
240 -- | [1, 2, 3] <#> \n -> n * n
240 -- | [1, 2, 3] <#> \n -> n * n
241 -- | ```
241 -- | ```
242 (<#>) :: forall f a b. (Functor f) => f a -> (a -> b) -> f b
242 (<#>) :: forall f a b. (Functor f) => f a -> (a -> b) -> f b
243 (<#>) fa f = f <$> fa
243 (<#>) fa f = f <$> fa
244
244
245− -- | The `void` function is used to ignore the type wrapped by a [`Functor`](#functor), replacing it with `Unit` and
245+ -- | The `void` function is used to ignore the type wrapped by a [`Functor`](#functor), replacing it with `Unit` and
246 -- | keeping only the type information provided by the type constructor itself.
246 -- | keeping only the type information provided by the type constructor itself.
247 -- |
247 -- |
248 -- | `void` is often useful when using `do` notation to change the return type of a monadic computation:
248 -- | `void` is often useful when using `do` notation to change the return type of a monadic computation:
@@ -258,7 +258,7 @@ module Prelude
258 infixl 4 <*>
258 infixl 4 <*>
259
259
260 -- | The `Apply` class provides the `(<*>)` which is used to apply a function to an argument under a type constructor.
260 -- | The `Apply` class provides the `(<*>)` which is used to apply a function to an argument under a type constructor.
261− -- |
261+ -- |
262 -- | `Apply` can be used to lift functions of two or more arguments to work on values wrapped with the type constructor `f`.
262 -- | `Apply` can be used to lift functions of two or more arguments to work on values wrapped with the type constructor `f`.
263 -- | It might also be understood in terms of the `lift2` function:
263 -- | It might also be understood in terms of the `lift2` function:
264 -- |
264 -- |
@@ -266,7 +266,7 @@ module Prelude
266 -- | lift2 :: forall f a b c. (Apply f) => (a -> b -> c) -> f a -> f b -> f c
266 -- | lift2 :: forall f a b c. (Apply f) => (a -> b -> c) -> f a -> f b -> f c
267 -- | lift2 f a b = f <$> a <*> b
267 -- | lift2 f a b = f <$> a <*> b
268 -- | ```
268 -- | ```
269− -- |
269+ -- |
270 -- | `(<*>)` is recovered from `lift2` as `lift2 ($)`. That is, `(<*>)` lifts the function application operator `($)` to arguments
270 -- | `(<*>)` is recovered from `lift2` as `lift2 ($)`. That is, `(<*>)` lifts the function application operator `($)` to arguments
271 -- | wrapped with the type constructor `f`.
271 -- | wrapped with the type constructor `f`.
272 -- |
272 -- |
@@ -280,9 +280,9 @@ module Prelude
280
280
281 -- | The `Applicative` type class extends the [`Apply`](#apply) type class with a `pure` function, which can be used to
281 -- | The `Applicative` type class extends the [`Apply`](#apply) type class with a `pure` function, which can be used to
282 -- | create values of type `f a` from values of type `a`.
282 -- | create values of type `f a` from values of type `a`.
283− -- |
283+ -- |
284− -- | Where [`Apply`](#apply) provides the ability to lift functions of two or more arguments to functions whose arguments are wrapped using `f`,
284+ -- | Where [`Apply`](#apply) provides the ability to lift functions of two or more arguments to functions whose arguments are wrapped using `f`,
285− -- | and [`Functor`](#functor) provides the ability to lift functions of one argument, `pure` can be seen as the function which lifts functions of
285+ -- | and [`Functor`](#functor) provides the ability to lift functions of one argument, `pure` can be seen as the function which lifts functions of
286 -- | _zero_ arguments. That is, `Applicative` functors support a lifting operation for any number of function arguments.
286 -- | _zero_ arguments. That is, `Applicative` functors support a lifting operation for any number of function arguments.
287 -- |
287 -- |
288 -- | `Applicative` instances should satisfy the following laws:
288 -- | `Applicative` instances should satisfy the following laws:
@@ -297,9 +297,9 @@ module Prelude
297
297
298 -- | `liftA1` provides a default implementation of `(<$>)` for any [`Applicative`](#applicative) functor,
298 -- | `liftA1` provides a default implementation of `(<$>)` for any [`Applicative`](#applicative) functor,
299 -- | without using `(<$>)` as provided by the [`Functor`](#functor)-[`Applicative`](#applicative) superclass relationship.
299 -- | without using `(<$>)` as provided by the [`Functor`](#functor)-[`Applicative`](#applicative) superclass relationship.
300− -- |
300+ -- |
301 -- | `liftA1` can therefore be used to write [`Functor`](#functor) instances as follows:
301 -- | `liftA1` can therefore be used to write [`Functor`](#functor) instances as follows:
302− -- |
302+ -- |
303 -- | ```purescript
303 -- | ```purescript
304 -- | instance functorF :: Functor F where
304 -- | instance functorF :: Functor F where
305 -- | (<$>) = liftA1
305 -- | (<$>) = liftA1
@@ -311,26 +311,26 @@ module Prelude
311
311
312 -- | The `Bind` type class extends the [`Apply`](#apply) type class with a "bind" operation `(>>=)` which composes computations
312 -- | The `Bind` type class extends the [`Apply`](#apply) type class with a "bind" operation `(>>=)` which composes computations
313 -- | in sequence, using the return value of one computation to determine the next computation.
313 -- | in sequence, using the return value of one computation to determine the next computation.
314− -- |
314+ -- |
315 -- | The `>>=` operator can also be expressed using `do` notation, as follows:
315 -- | The `>>=` operator can also be expressed using `do` notation, as follows:
316− -- |
316+ -- |
317 -- | ```purescript
317 -- | ```purescript
318 -- | x >>= f = do y <- x
318 -- | x >>= f = do y <- x
319 -- | f y
319 -- | f y
320 -- | ```
320 -- | ```
321− -- |
321+ -- |
322 -- | where the function argument of `f` is given the name `y`.
322 -- | where the function argument of `f` is given the name `y`.
323− -- |
323+ -- |
324 -- | `Bind` instances should satisfy the following law:
324 -- | `Bind` instances should satisfy the following law:
325 -- |
325 -- |
326 -- | - Associativity: `(x >>= f) >>= g = x >>= (\k => f k >>= g)`
326 -- | - Associativity: `(x >>= f) >>= g = x >>= (\k => f k >>= g)`
327 -- |
327 -- |
328− -- | Or, expressed using `do` notation:
328+ -- | Or, expressed using `do` notation:
329− -- |
329+ -- |
330 -- | - Associativity: `do { z <- do { y <- x ; f y } ; g z } = do { k <- x ; do { y <- f k ; g y } }`
330 -- | - Associativity: `do { z <- do { y <- x ; f y } ; g z } = do { k <- x ; do { y <- f k ; g y } }`
331− -- |
331+ -- |
332 -- | Associativity tells us that we can regroup operations which use do-notation, so that we can unambiguously write, for example:
332 -- | Associativity tells us that we can regroup operations which use do-notation, so that we can unambiguously write, for example:
333− -- |
333+ -- |
334 -- | ```purescript
334 -- | ```purescript
335 -- | do x <- m1
335 -- | do x <- m1
336 -- | y <- m2 x
336 -- | y <- m2 x
@@ -347,11 +347,11 @@ module Prelude
347 -- | - Left Identity: `pure x >>= f = f x`
347 -- | - Left Identity: `pure x >>= f = f x`
348 -- | - Right Identity: `x >>= pure = x`
348 -- | - Right Identity: `x >>= pure = x`
349 -- |
349 -- |
350− -- | Or, expressed using `do` notation:
350+ -- | Or, expressed using `do` notation:
351− -- |
351+ -- |
352 -- | - Left Identity: `do { y <- pure x ; f y } = f x`
352 -- | - Left Identity: `do { y <- pure x ; f y } = f x`
353 -- | - Right Identity: `do { y <- x ; pure y } = x`
353 -- | - Right Identity: `do { y <- x ; pure y } = x`
354− -- |
354+ -- |
355 class (Applicative m, Bind m) <= Monad m
355 class (Applicative m, Bind m) <= Monad m
356
356
357 -- | `return` is an alias for `pure`.
357 -- | `return` is an alias for `pure`.
@@ -360,9 +360,9 @@ module Prelude
360
360
361 -- | `liftM1` provides a default implementation of `(<$>)` for any [`Monad`](#monad),
361 -- | `liftM1` provides a default implementation of `(<$>)` for any [`Monad`](#monad),
362 -- | without using `(<$>)` as provided by the [`Functor`](#functor)-[`Monad`](#monad) superclass relationship.
362 -- | without using `(<$>)` as provided by the [`Functor`](#functor)-[`Monad`](#monad) superclass relationship.
363− -- |
363+ -- |
364 -- | `liftM1` can therefore be used to write [`Functor`](#functor) instances as follows:
364 -- | `liftM1` can therefore be used to write [`Functor`](#functor) instances as follows:
365− -- |
365+ -- |
366 -- | ```purescript
366 -- | ```purescript
367 -- | instance functorF :: Functor F where
367 -- | instance functorF :: Functor F where
368 -- | (<$>) = liftM1
368 -- | (<$>) = liftM1
@@ -374,9 +374,9 @@ module Prelude
374
374
375 -- | `ap` provides a default implementation of `(<*>)` for any [`Monad`](#monad),
375 -- | `ap` provides a default implementation of `(<*>)` for any [`Monad`](#monad),
376 -- | without using `(<*>)` as provided by the [`Apply`](#apply)-[`Monad`](#monad) superclass relationship.
376 -- | without using `(<*>)` as provided by the [`Apply`](#apply)-[`Monad`](#monad) superclass relationship.
377− -- |
377+ -- |
378 -- | `ap` can therefore be used to write [`Apply`](#apply) instances as follows:
378 -- | `ap` can therefore be used to write [`Apply`](#apply) instances as follows:
379− -- |
379+ -- |
380 -- | ```purescript
380 -- | ```purescript
381 -- | instance applyF :: Apply F where
381 -- | instance applyF :: Apply F where
382 -- | (<*>) = ap
382 -- | (<*>) = ap
@@ -515,7 +515,7 @@ module Prelude
515 instance numNumber :: Num Number
515 instance numNumber :: Num Number
516
516
517 -- | The `Unit` type has a single inhabitant, called `unit`. It represents values with no computational content.
517 -- | The `Unit` type has a single inhabitant, called `unit`. It represents values with no computational content.
518− -- |
518+ -- |
519 -- | `Unit` is often used, wrapped in a monadic type constructor, as the return type of a computation where only
519 -- | `Unit` is often used, wrapped in a monadic type constructor, as the return type of a computation where only
520 -- | the _effects_ are important.
520 -- | the _effects_ are important.
521 newtype Unit = Unit {}
521 newtype Unit = Unit {}
@@ -530,13 +530,13 @@ module Prelude
530 -- | The `Eq` type class represents types which support decidable equality.
530 -- | The `Eq` type class represents types which support decidable equality.
531 -- |
531 -- |
532 -- | `Eq` instances should satisfy the following laws:
532 -- | `Eq` instances should satisfy the following laws:
533− -- |
533+ -- |
534 -- | - Reflexivity: `x == x = true`
534 -- | - Reflexivity: `x == x = true`
535 -- | - Symmetry: `x == y = y == x`
535 -- | - Symmetry: `x == y = y == x`
536 -- | - Transitivity: if `x == y` and `y == z` then `x == z`
536 -- | - Transitivity: if `x == y` and `y == z` then `x == z`
537 -- | - Negation: `x /= y = not (x == y)`
537 -- | - Negation: `x /= y = not (x == y)`
538 -- |
538 -- |
539− -- | `(/=)` may be implemented in terms of `(==)`, but it might give a performance improvement to implement it separately.
539+ -- | `(/=)` may be implemented in terms of `(==)`, but it might give a performance improvement to implement it separately.
540 class Eq a where
540 class Eq a where
541 (==) :: a -> a -> Boolean
541 (==) :: a -> a -> Boolean
542 (/=) :: a -> a -> Boolean
542 (/=) :: a -> a -> Boolean
@@ -595,7 +595,7 @@ module Prelude
595 (/=) xs ys = not (xs == ys)
595 (/=) xs ys = not (xs == ys)
596
596
597 -- | The `Ordering` data type represents the three possible outcomes of comparing two values:
597 -- | The `Ordering` data type represents the three possible outcomes of comparing two values:
598− -- |
598+ -- |
599 -- | `LT` - The first value is _less than_ the second.
599 -- | `LT` - The first value is _less than_ the second.
600 -- | `GT` - The first value is _greater than_ the second.
600 -- | `GT` - The first value is _greater than_ the second.
601 -- | `EQ` - The first value is _equal to_ or _incomparable to_ the second.
601 -- | `EQ` - The first value is _equal to_ or _incomparable to_ the second.
@@ -790,9 +790,9 @@ module Prelude
790 infixr 3 &&
790 infixr 3 &&
791
791
792 -- | The `BoolLike` type class identifies types which support Boolean operations.
792 -- | The `BoolLike` type class identifies types which support Boolean operations.
793− -- |
793+ -- |
794 -- | `BoolLike` instances are required to satisfy the laws of a _Boolean algebra_.
794 -- | `BoolLike` instances are required to satisfy the laws of a _Boolean algebra_.
795− -- |
795+ -- |
796 class BoolLike b where
796 class BoolLike b where
797 (&&) :: b -> b -> b
797 (&&) :: b -> b -> b
798 (||) :: b -> b -> b
798 (||) :: b -> b -> b
@@ -831,12 +831,12 @@ module Prelude
831 infixr 5 <>
831 infixr 5 <>
832
832
833 -- | The `Semigroup` type class identifies an associative operation on a type.
833 -- | The `Semigroup` type class identifies an associative operation on a type.
834− -- |
834+ -- |
835 -- | `Semigroup` instances are required to satisfy the following law:
835 -- | `Semigroup` instances are required to satisfy the following law:
836− -- |
836+ -- |
837 -- | - Associativity: `(x <> y) <> z = x <> (y <> z)`
837 -- | - Associativity: `(x <> y) <> z = x <> (y <> z)`
838− -- |
838+ -- |
839− -- | For example, the `String` type is an instance of `Semigroup`, where `(<>)` is defined to be string concatenation.
839+ -- | For example, the `String` type is an instance of `Semigroup`, where `(<>)` is defined to be string concatenation.
840 class Semigroup a where
840 class Semigroup a where
841 (<>) :: a -> a -> a
841 (<>) :: a -> a -> a
842
842
@@ -867,9 +867,9 @@ module Prelude
867module Data.Function where
867module Data.Function where
868
868
869 -- | The `on` function is used to change the domain of a binary operator.
869 -- | The `on` function is used to change the domain of a binary operator.
870− -- |
870+ -- |
871 -- | For example, we can create a function which compares two records based on the values of their `x` properties:
871 -- | For example, we can create a function which compares two records based on the values of their `x` properties:
872− -- |
872+ -- |
873 -- | ```purescript
873 -- | ```purescript
874 -- | compareX :: forall r. { x :: Number | r } -> { x :: Number | r } -> Ordering
874 -- | compareX :: forall r. { x :: Number | r } -> { x :: Number | r } -> Ordering
875 -- | compareX = compare `on` _.x
875 -- | compareX = compare `on` _.x
@@ -1221,7 +1221,7 @@ module Data.Function where
1221module Prelude.Unsafe where
1221module Prelude.Unsafe where
1222
1222
1223 -- | Find the element of an array at the specified index.
1223 -- | Find the element of an array at the specified index.
1224− -- |
1224+ -- |
1225 -- | Note: this function can cause unpredictable failure at runtime if the index is out-of-bounds.
1225 -- | Note: this function can cause unpredictable failure at runtime if the index is out-of-bounds.
1226 foreign import unsafeIndex
1226 foreign import unsafeIndex
1227 """
1227 """
@@ -1232,7 +1232,7 @@ module Prelude.Unsafe where
1232 }
1232 }
1233 """ :: forall a. [a] -> Number -> a
1233 """ :: forall a. [a] -> Number -> a
1234
1234
1235−module Control.Monad.Eff
1235+module Control.Monad.Eff
1236 ( Eff()
1236 ( Eff()
1237 , Pure()
1237 , Pure()
1238 , runPure
1238 , runPure
@@ -1297,8 +1297,8 @@ module Control.Monad.Eff
1297 instance monadEff :: Monad (Eff e)
1297 instance monadEff :: Monad (Eff e)
1298
1298
1299 -- | Loop until a condition becomes `true`.
1299 -- | Loop until a condition becomes `true`.
1300− -- |
1300+ -- |
1301− -- | `untilE b` is an effectful computation which repeatedly runs the effectful computation `b`,
1301+ -- | `untilE b` is an effectful computation which repeatedly runs the effectful computation `b`,
1302 -- | until its return value is `true`.
1302 -- | until its return value is `true`.
1303 foreign import untilE
1303 foreign import untilE
1304 """
1304 """
@@ -1311,8 +1311,8 @@ module Control.Monad.Eff
1311 """ :: forall e. Eff e Boolean -> Eff e Unit
1311 """ :: forall e. Eff e Boolean -> Eff e Unit
1312
1312
1313 -- | Loop while a condition is `true`.
1313 -- | Loop while a condition is `true`.
1314− -- |
1314+ -- |
1315− -- | `whileE b m` is effectful computation which runs the effectful computation `b`. If its result is
1315+ -- | `whileE b m` is effectful computation which runs the effectful computation `b`. If its result is
1316 -- | `true`, it runs the effectful computation `m` and loops. If not, the computation ends.
1316 -- | `true`, it runs the effectful computation `m` and loops. If not, the computation ends.
1317 foreign import whileE
1317 foreign import whileE
1318 """
1318 """
@@ -1329,7 +1329,7 @@ module Control.Monad.Eff
1329 """ :: forall e a. Eff e Boolean -> Eff e a -> Eff e Unit
1329 """ :: forall e a. Eff e Boolean -> Eff e a -> Eff e Unit
1330
1330
1331 -- | Loop over a consecutive collection of numbers.
1331 -- | Loop over a consecutive collection of numbers.
1332− -- |
1332+ -- |
1333 -- | `forE lo hi f` runs the computation returned by the function `f` for each of the inputs
1333 -- | `forE lo hi f` runs the computation returned by the function `f` for each of the inputs
1334 -- | between `lo` (inclusive) and `hi` (exclusive).
1334 -- | between `lo` (inclusive) and `hi` (exclusive).
1335 foreign import forE
1335 foreign import forE
@@ -1348,7 +1348,7 @@ module Control.Monad.Eff
1348 """ :: forall e. Number -> Number -> (Number -> Eff e Unit) -> Eff e Unit
1348 """ :: forall e. Number -> Number -> (Number -> Eff e Unit) -> Eff e Unit
1349
1349
1350 -- | Loop over an array of values.
1350 -- | Loop over an array of values.
1351− -- |
1351+ -- |
1352 -- | `foreach xs f` runs the computation returned by the function `f` for each of the inputs `xs`.
1352 -- | `foreach xs f` runs the computation returned by the function `f` for each of the inputs `xs`.
1353 foreign import foreachE
1353 foreign import foreachE
1354 """
1354 """
@@ -1368,7 +1368,7 @@ module Control.Monad.Eff.Unsafe where
1368 import Control.Monad.Eff
1368 import Control.Monad.Eff
1369
1369
1370 -- | Change the type of an effectful computation, allowing it to be run in another context.
1370 -- | Change the type of an effectful computation, allowing it to be run in another context.
1371− -- |
1371+ -- |
1372 -- | Note: use of this function can result in arbitrary side-effects.
1372 -- | Note: use of this function can result in arbitrary side-effects.
1373 foreign import unsafeInterleaveEff
1373 foreign import unsafeInterleaveEff
1374 """
1374 """
@@ -1404,9 +1404,9 @@ module Control.Monad.ST where
1404 import Control.Monad.Eff
1404 import Control.Monad.Eff
1405
1405
1406 -- | The `ST` effect represents _local mutation_, i.e. mutation which does not "escape" into the surrounding computation.
1406 -- | The `ST` effect represents _local mutation_, i.e. mutation which does not "escape" into the surrounding computation.
1407− -- |
1407+ -- |
1408 -- | An `ST` computation is parameterized by a phantom type which is used to restrict the set of reference cells it is allowed to access.
1408 -- | An `ST` computation is parameterized by a phantom type which is used to restrict the set of reference cells it is allowed to access.
1409− -- |
1409+ -- |
1410 -- | The `runST` function can be used to handle the `ST` effect.
1410 -- | The `runST` function can be used to handle the `ST` effect.
1411 foreign import data ST :: * -> !
1411 foreign import data ST :: * -> !
1412
1412
@@ -1458,10 +1458,10 @@ module Control.Monad.ST where
1458 """ :: forall a h r. STRef h a -> a -> Eff (st :: ST h | r) a
1458 """ :: forall a h r. STRef h a -> a -> Eff (st :: ST h | r) a
1459
1459
1460 -- | Run an `ST` computation.
1460 -- | Run an `ST` computation.
1461− -- |
1461+ -- |
1462 -- | Note: the type of `runST` uses a rank-2 type to constrain the phantom type `s`, such that the computation must not leak any mutable references
1462 -- | Note: the type of `runST` uses a rank-2 type to constrain the phantom type `s`, such that the computation must not leak any mutable references
1463 -- | to the surrounding computation.
1463 -- | to the surrounding computation.
1464− -- |
1464+ -- |
1465 -- | It may cause problems to apply this function using the `$` operator. The recommended approach is to use parentheses instead.
1465 -- | It may cause problems to apply this function using the `$` operator. The recommended approach is to use parentheses instead.
1466 foreign import runST
1466 foreign import runST
1467 """
1467 """