avh4 / elm-debug-controls

Easily build interactive UIs for complex data structures
https://avh4.github.io/elm-debug-controls/
BSD 3-Clause "New" or "Revised" License
24 stars 4 forks source link

Make Debug.Control.choice take a nonempty list #11

Open MartinSStewart opened 4 years ago

MartinSStewart commented 4 years ago

In the documentation for Debug.Control.choice it says

This will crash if you provide an empty list.

Why not change the type signature to ( String, Control a ) -> List ( String, Control a ) -> Control a so that can never happen?

avh4 commented 4 years ago

Yeah, I think that's a good change. It wasn't done originally because when I ported this to Elm 0.19, it wasn't yet clear what the community preference would be w/r to this sort of API, but I think your proposed type makes sense now.