Skip to content

Commit 7078ba0

Browse files
committed
Remove LazyN variants, resolves #15
1 parent 832845b commit 7078ba0

File tree

3 files changed

+7
-57
lines changed

3 files changed

+7
-57
lines changed

README.md

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ laws:
5050
#### `some`
5151

5252
``` purescript
53-
some :: forall f a. (Alternative f, Lazy1 f) => f a -> f [a]
53+
some :: forall f a. (Alternative f, Lazy (f [a])) => f a -> f [a]
5454
```
5555

5656
Attempt a computation multiple times, requiring at least one success.
@@ -61,7 +61,7 @@ termination.
6161
#### `many`
6262

6363
``` purescript
64-
many :: forall f a. (Alternative f, Lazy1 f) => f a -> f [a]
64+
many :: forall f a. (Alternative f, Lazy (f [a])) => f a -> f [a]
6565
```
6666

6767
Attempt a computation multiple times, returning as many successful results
@@ -329,24 +329,6 @@ to be _deferred_.
329329
Usually, this means that a type contains a function arrow which can
330330
be used to delay evaluation.
331331

332-
#### `Lazy1`
333-
334-
``` purescript
335-
class Lazy1 l where
336-
defer1 :: forall a. (Unit -> l a) -> l a
337-
```
338-
339-
A version of `Lazy` for type constructors of one type argument.
340-
341-
#### `Lazy2`
342-
343-
``` purescript
344-
class Lazy2 l where
345-
defer2 :: forall a b. (Unit -> l a b) -> l a b
346-
```
347-
348-
A version of `Lazy` for type constructors of two type arguments.
349-
350332
#### `fix`
351333

352334
``` purescript
@@ -357,22 +339,6 @@ fix :: forall l a. (Lazy l) => (l -> l) -> l
357339

358340
The `Lazy` instance allows us to generate the result lazily.
359341

360-
#### `fix1`
361-
362-
``` purescript
363-
fix1 :: forall l a. (Lazy1 l) => (l a -> l a) -> l a
364-
```
365-
366-
A version of `fix` for type constructors of one type argument.
367-
368-
#### `fix2`
369-
370-
``` purescript
371-
fix2 :: forall l a b. (Lazy2 l) => (l a b -> l a b) -> l a b
372-
```
373-
374-
A version of `fix` for type constructors of two type arguments.
375-
376342

377343
## Module Control.Monad
378344

@@ -382,7 +348,7 @@ This module defines helper functions for working with `Monad` instances.
382348
#### `replicateM`
383349

384350
``` purescript
385-
replicateM :: forall m a. (Monad m) => Number -> m a -> m [a]
351+
replicateM :: forall m a. (Monad m) => Int -> m a -> m [a]
386352
```
387353

388354
Perform a monadic action `n` times collecting all of the results.
@@ -419,7 +385,7 @@ filterM :: forall a m. (Monad m) => (a -> m Boolean) -> [a] -> m [a]
419385

420386
Filter where the predicate returns a monadic `Boolean`.
421387

422-
For example:
388+
For example:
423389

424390
```purescript
425391
powerSet :: forall a. [a] -> [[a]]

src/Control/Alternative.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ class (Applicative f, Plus f) <= Alternative f
2121
-- |
2222
-- | The `Lazy` constraint is used to generate the result lazily, to ensure
2323
-- | termination.
24-
some :: forall f a. (Alternative f, Lazy1 f) => f a -> f [a]
25-
some v = (:) <$> v <*> defer1 (\_ -> many v)
24+
some :: forall f a. (Alternative f, Lazy (f [a])) => f a -> f [a]
25+
some v = (:) <$> v <*> defer (\_ -> many v)
2626

2727
-- | Attempt a computation multiple times, returning as many successful results
2828
-- | as possible (possibly zero).
2929
-- |
3030
-- | The `Lazy` constraint is used to generate the result lazily, to ensure
3131
-- | termination.
32-
many :: forall f a. (Alternative f, Lazy1 f) => f a -> f [a]
32+
many :: forall f a. (Alternative f, Lazy (f [a])) => f a -> f [a]
3333
many v = some v <|> pure []
3434

src/Control/Lazy.purs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,8 @@ module Control.Lazy where
1111
class Lazy l where
1212
defer :: (Unit -> l) -> l
1313

14-
-- | A version of `Lazy` for type constructors of one type argument.
15-
class Lazy1 l where
16-
defer1 :: forall a. (Unit -> l a) -> l a
17-
18-
-- | A version of `Lazy` for type constructors of two type arguments.
19-
class Lazy2 l where
20-
defer2 :: forall a b. (Unit -> l a b) -> l a b
21-
2214
-- | `fix` defines a value as the fixed point of a function.
2315
-- |
2416
-- | The `Lazy` instance allows us to generate the result lazily.
2517
fix :: forall l a. (Lazy l) => (l -> l) -> l
2618
fix f = defer (\_ -> f (fix f))
27-
28-
-- | A version of `fix` for type constructors of one type argument.
29-
fix1 :: forall l a. (Lazy1 l) => (l a -> l a) -> l a
30-
fix1 f = defer1 (\_ -> f (fix1 f))
31-
32-
-- | A version of `fix` for type constructors of two type arguments.
33-
fix2 :: forall l a b. (Lazy2 l) => (l a b -> l a b) -> l a b
34-
fix2 f = defer2 (\_ -> f (fix2 f))

0 commit comments

Comments
 (0)