sharkdp / purescript-flare

A special-purpose UI library for Purescript
287 stars 17 forks source link

Use purescript-nonempty #11

Closed sharkdp closed 8 years ago

sharkdp commented 8 years ago

The API for select and radioGroup would be much nicer with NonEmpty a instead of .. -> a -> Array a -> ...

sharkdp commented 8 years ago
select :: forall e a. Label -> NonEmpty (Array a) -> (a -> String) -> UI e a

data Foo = A | B | C | D

fooToStr :: Foo -> String
fooToStr = ...

select "One of:" (A :| [B, C, D]) fooToStr

This would also be a good opportunity to change Array to Foldable (Relies on https://github.com/purescript/purescript-arrays/pull/55):

select "One of:" (A :| B : C : D : Nil) fooToStr