-
Notifications
You must be signed in to change notification settings - Fork 23
Add more documentation examples #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
-- | unfoldr1 g 3 == NEA.cons' 3 [2, 1, 0] | ||
-- | unfoldr1 g 3 == NEL.cons' 3 (2 : 1 : 0 : Nil) | ||
-- | -- Also produces structures of types which can be empty | ||
-- | unfoldr1 g 3 == [3, 2, 1, 0] | ||
-- | unfoldr1 g 3 == 3 : 2 : 1 : 0 : Nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if this REPL-style sequence is clearer:
> unfoldr1 g 3 :: NonEmptyArray Int
(NonEmptyArray [3,2,1,0])
> unfoldr1 g 3 :: NonEmptyList _
(NonEmptyList (NonEmpty 3 (2 : 1 : 0 : Nil)))
> unfoldr1 g 3 :: Array _
[3,2,1,0]
> unfoldr1 g 3 :: List _
(3 : 2 : 1 : 0 : Nil)
Also, there's some inconsistency with show
for NonEmptyArray
vs NonEmptyList
. The Array
version is a lot more concise.
-- | > replicate1A 2 (randomInt 1 10) :: Effect (NonEmptyList Int) | ||
-- | (NonEmptyList (NonEmpty 8 (2 : Nil))) | ||
-- | > replicate1A 0 (randomInt 1 10) :: Effect (NEL.NonEmptyList Int) | ||
-- | (NonEmptyList (NonEmpty 4 Nil)) | ||
-- | > replicate1A 0 (randomInt 1 10) :: _ (NonEmptyArray _) | ||
-- | (NonEmptyArray [3]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these work too? Missing Traversable1
:
replicate1A 0 (randomInt 1 10) :: _ (List _)
replicate1A 2 (randomInt 1 10) :: _ (Array _)
-- | range 0 0 == (NEL.singleton 0 :: NEL.NonEmptyList Int) | ||
-- | range 1 2 == (NEL.cons 1 (NEL.singleton 2) :: NEL.NonEmptyList Int) | ||
-- | range 2 0 == (NEL.cons 2 (NEL.cons 1 (NEL.singleton 0)) :: NEL.NonEmptyList Int) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Writing the Non-empty examples is kinda clumsy without purescript/purescript-lists#190
In Progress
Description of the change
Fixes #31
Adding some more description and examples
Checklist: