tweag/nickel

Standard library stabilization

yannham opened this issue · 3 comments

#254 describes the next batch of functions to add to the standard library to have a minimum viable one. While it's currently not yet closed, the implementation should end soon. This issue tracks the second phase of tasks to achieve with respect to the standard library.

  • Write tests
  • Write documentation
  • Stabilize naming, make it consistent
  • Stabilize types, make them consistent
  • Stabilize provided contracts, make their names and implementation consistent

Now that we have |>, it feels like strings.join should be flipped to Str -> List Str -> Str

Hopefully, this is not off-topic, here's a bunch of functions I ended up re-implementing while writing some Nickel, and more that I think I may end up wanting:

nums.clamp : Num -> Num -> Num -> Num
functions.flip : forall a b c. (a -> b -> c) -> b -> a -> c // Although I don't suppose I'll use it as much after my PR
lists.optional : Bool -> List -> List
records.optional : Bool -> { _: Dyn } -> { _: Dyn }
records.filter : (Str -> Dyn -> Bool) -> { _: Dyn } -> { _: Dyn }
records.toList : { _: Dyn } -> List { key: Str, value: Dyn } // or: records.entriesOf
records.fromList : List { key: Str, value: Dyn } -> { _: Dyn } // or: records.fromEntries

E: base64 en/decode would be great too

This issue is superseded by #935