Add Unfoldable1#22
Conversation
| import Data.Tuple (Tuple(..)) | ||
|
|
||
| -- | This class identifies non-empty data structures which can be _unfolded_, | ||
| -- | generalizing `unfoldr1` on non-empty lists or arrays. |
There was a problem hiding this comment.
unfoldr1 is not provided elsewhere, so maybe nix that part of the comment?
There was a problem hiding this comment.
Hmm, good point, unfoldr is not provided elsewhere either so I guess that applies to both modules.
There was a problem hiding this comment.
Must have been copy-paste from some Haskell?
| :: forall m f a | ||
| . Applicative m | ||
| => Unfoldable1 f | ||
| => Traversable f |
There was a problem hiding this comment.
Traversable1 would let you generalize to Apply, no?
|
I'm glad one of us is paying attention 😉 |
| | i <= 0 = Tuple v Nothing | ||
| | otherwise = Tuple v (Just (i - 1)) | ||
|
|
||
| -- | Perform an `Applicative` action `n` times (at least once, so values `n < 1` |
There was a problem hiding this comment.
Not sure if you want this to still say Applicative, though "Perform an Apply action" doesn't read well either.
There was a problem hiding this comment.
I went with saying exactly that in the end, it does read a little strangely because of the syntax at the English level, but it's not inaccurate 😄
will amend upon merging of purescript/purescript-unfoldable#22
|
Oh right! I knew there was something I had left pending. Will update the comment and merge this tomorrow, I'm off to bed now. |
will amend upon merging of purescript/purescript-unfoldable#22
Resolves #19
/cc @matthewleon