Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upList.singleton clarity #860
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
process-bot
Apr 27, 2017
Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!
Here is what to expect next, and if anyone wants to comment, keep these things in mind.
process-bot
commented
Apr 27, 2017
|
Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it! Here is what to expect next, and if anyone wants to comment, keep these things in mind. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
simonewebdesign
Apr 27, 2017
To be fair, we might as well just remove it.
The implementation actually just wraps the value in [], so if the function name is confusing I don't see any point in keeping it.
Are there any use cases for it?
simonewebdesign
commented
Apr 27, 2017
|
To be fair, we might as well just remove it. The implementation actually just wraps the value in |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Yes it's useful. It allows to be point free. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Angarsk8
May 3, 2017
I was wondering the same today. This is current implementation of the singleton/1 function:
singleton : a -> List a
singleton value =
[value]IMHO something that simple should not be abstracted, but I'd like to know the reasons behind its existence, maybe we're all missing something.
Angarsk8
commented
May 3, 2017
|
I was wondering the same today. This is current implementation of the singleton : a -> List a
singleton value =
[value]IMHO something that simple should not be abstracted, but I'd like to know the reasons behind its existence, maybe we're all missing something. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
roine
commented
May 3, 2017
|
Use case
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
turboMaCk
May 17, 2017
Contributor
It's useful. List.singleton is actually pure implementation for List as a Applicative.
It's useful for lifting function to List context. Unluckilly andMap is missing in core and can be found only in List.Extra.
Actual questions in my opinion are:
- Does
singletonmake sense withoutandMap?? - Should
Listin core implement applicative style since most folks don't use it?
|
It's useful. It's useful for lifting function to List context. Unluckilly Actual questions in my opinion are:
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
lukewestby
May 17, 2017
Member
Hey folks, this conversation belongs on elm-discuss or in slack. GitHub issues are for bugs, so as long as List.singleton works as advertised discussions about the name should be taken to the mailing list or slack.
|
Hey folks, this conversation belongs on elm-discuss or in slack. GitHub issues are for bugs, so as long as |
tibastral commentedApr 27, 2017
Hello everybody,
List.singleton seems a little confusing, especially for people coming from OOP. As stated, we want to be mainstream.
Mathematically, List.unit would work as well and would be a little less confusing. Stack overflow discussion, Wikipedia