API Ideas
This is for organization. Open a separate issue for your particular idea.
This is a collection of API ideas that have sprouted up as folks have used core. It is not an invitation to do a free for all of changes. I am just collecting the most promising ideas in one place so that we can assess them all together in a coherent way.
Primitives
- #417 - bindings to
Number.toFixed - #657 - rename
toString - #593 - add
Never -> afunction
Data Structures
- #408 - add
List.singleton - #317 - have
Dict.keysreturn aSet - https://github.com/elm-lang/elm-compiler/issues/646 - add
Array.remove - #298 - add
Array.update - #366 - negative indexes in
Array.getandArray.set - #699 - make
Array.slice 3 0take until the end of the array - https://github.com/elm-community/maybe-extra/pull/5 - super interesting discussion of naming
- #776 - flip arguments of
List.append
Maybe and Result
- #720 - rename
Result.formatErrortoResult.mapErrorto matchTask.mapError - #369 - clearly define the "use case" for
MaybeandResultin APIs - #164 - add
Maybe.isNothing
Json
- #484 - Add
Encode.dict
Tasks
- generate random numbers - #924
-
Task.parallel- #223 - reorder args of
andThenso backticks can be removed - thread - add
Time.utcOffset- https://github.com/elm-lang/elm-compiler/pull/705, #486 - move
Process.sleeptoTask.sleep- #693
When thinking about what is in core, here is a good way to organize it:
| Basic types | Containers | Graphics | Network | User interaction | Utils |
|---|---|---|---|---|---|
| Basics | Array | Color | Keyboard | Debug | |
| Bitwise | List | Graphics.Element | Mouse | Json.Decode | |
| Char | Set | Graphics.Collage | Touch | Json.Encode | |
| Maybe | Dict | Graphics.Input | Window | Random | |
| Result | Graphics.Input.Field | Time | |||
| Signal | Text | Date | |||
| Task | Transform2D | Regex | |||
| String | Trampoline |
As you can see, there are no networking modules left in core. Http and Websocket were removed after 0.15, when their APIs were migrated to use Tasks instead of Signals. Organizing the classes like this in the documentation would make it much easier for developers to understand what is in core.