core icon indicating copy to clipboard operation
core copied to clipboard

API Ideas

Open evancz opened this issue 10 years ago • 1 comments

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 -> a function

Data Structures

  • #408 - add List.singleton
  • #317 - have Dict.keys return a Set
  • https://github.com/elm-lang/elm-compiler/issues/646 - add Array.remove
  • #298 - add Array.update
  • #366 - negative indexes in Array.get and Array.set
  • #699 - make Array.slice 3 0 take 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.formatError to Result.mapError to match Task.mapError
  • #369 - clearly define the "use case" for Maybe and Result in APIs
  • #164 - add Maybe.isNothing

Json

  • #484 - Add Encode.dict

Tasks

  • generate random numbers - #924
  • Task.parallel - #223
  • reorder args of andThen so backticks can be removed - thread
  • add Time.utcOffset - https://github.com/elm-lang/elm-compiler/pull/705, #486
  • move Process.sleep to Task.sleep - #693

evancz avatar Aug 02 '15 04:08 evancz

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.

laszlopandy avatar Sep 11 '15 08:09 laszlopandy