Skip to content

Releases: reazen/relude

v0.23.0

13 Aug 17:32
Compare
Choose a tag to compare

Documentation release

✨ New stuff

Added documentation to the majority of the functions in the library. Our current stance is to not use the .rei interfaces because of the pain it creates with our include magic, so I went ahead and put in docs in the .re files. I'll remove the Array and List.rei files in another release.

🚨 Breaking changes

Several modules/module functors were renamed for the sake of consistency across the library. These naming conventions don't need to be set in stone this way, but I at least wanted things to be consistent across our modules. I know the Make convention is common in ocaml module functors, but we don't have a convention for using that in relude at the moment. We can move in that direction, but we need to consider how to name the extension module functions, specifically the nested ones like Foldable to avoid conflicts with names like Make.

  • HMap.Make -> HMap.WithKeyMeta (for consistency with things like Result.WithError, IO.WithError
  • HMap.WithUnitKeyMeta -> HMap.WithKeyMetaUnit - named to sound more like how its constructed with the module functor HMap.WithKeyMeta(Unit.Type)
  • ContT.WithEnv -> ContT.WithResult - fixes an incorrect name for the result type module
  • ContT.WithMonadAndEnv -> ContT.WithMonadAndResult - fixes incorrect name
  • Map.Map -> Map.MAP - we followed the convention of bs-abstract naming module types in all caps
  • Map.MakeWithOrderable -> Map.WithOrd - consistency with Result.WithError, etc.
  • Set.Set -> Set.SET - module types in all caps, like bs-abstract
  • Relude_Extensions_Ord.Make -> Relude_Extensions_Ord.OrdExtensions - consistency with other extensions that have the {Module}Extensions and {Module}Infix module functors
  • Relude_Extensions_Ord.MakeWithRing -> moved inside Relude_Extensions_Ord.OrdExtensions.OrdRingExtensions - for consistency with the nested Foldable extensions
  • Relude_Extensions_Ring.Make -> Relude_Extensions_Ring.RingExtensions - for consistency with other extensions named like {Module}Extensions and {Module}Infix

v0.22.0

09 Aug 02:27
Compare
Choose a tag to compare

✨ New stuff

  • Add Nea, Nel, NonEmptyArray, and NonEmptyList to Relude.Globals

v0.21.0

08 Aug 04:28
Compare
Choose a tag to compare

✨ New stuff

  • Relude.HList - an initial heterogeneous list type - a list that can store values of different types, in a type-safe way
    • TODO: ways to fold/map/etc. with polymorphic functions?
  • Relude.HMap - an initial heterogeneous map type - a map that can store values of different types, in a type-safe way

🚨 Breaking changes

  • Relude.String function minor refactor
    • Many of the Relude.String functions accept multiple ambiguous string arguments - this release has changed several of these methods to use named args for the non-primary string arguments.
    • Affected functions:
      • endsWith
      • startsWith
      • contains
      • indexOf
      • lastIndexOf
      • splitList
      • splitArray
      • replaceFirst
      • replaceEach
      • replaceRegex
      • removeFirst
      • removeEach
    • The refactor should be straightforward to fix. The argument order has not changed, but the non-last string arguments now have labels. Add argument names like ~search, ~replaceWith, ~delimiter etc.

v0.20.0

05 Aug 17:39
Compare
Choose a tag to compare

This release focuses on improving int and float helpers. Additionally, a few modules and functions have been added to Globals, plus the usual bugfixes and consistency updates.

🚨 Breaking changes

  • Remove State, Reader, and Writer from Relude.Globals, due to the possibility of collision. They can still be accessed via Relude.Globals.StateT.State etc

✨ New stuff

  • String and Int join Float in bringing along Ord extras (e.g. min, gte, etc)
  • Add clamp and between to Ord (along with all modules that implement Ord)
  • Make float and int members of Semiring and Ring
  • Add abs and signum to all modules that implement both Ord and Ring
  • open Relude.Globals now brings Bool, inverse, Void, and absurd into scope
  • Array includes mapOption and catOption, which work similarly to their List counterparts
  • add Int.toFloat, Int.fromFloat, Float.toInt, and Float.fromInt
  • add several rounding/precision functions to Float, including floor, ceil, and round, plus versions of each that convert the result to an int

🐛 Bug fixes

  • Fix typo in String.isNonWhitespace name (technically this is a breaking change...)

✔️ Code quality

  • Test coverage improved, particularly for String

v0.19.0

16 Jul 17:06
Compare
Choose a tag to compare

✨ New

  • Changed Result and IO catchError function to allow changing the inner 'e error type. This should not break existing usages of the previously more restrictive version.

v0.18.0

05 Jul 16:03
Compare
Choose a tag to compare

✨ New stuff

  • Added replaceAt for List and Array - replaces an item in the List/Array at the given index

v0.17.0

03 Jul 16:34
Compare
Choose a tag to compare

✨ New stuff

  • Added uncons to NonEmpty.List and NonEmpty.Array to extract the contained values as a tuple of head and tail.
NonEmpty.List.uncons(NonEmpty.List.make(1, [2, 3])) // (1, [2, 3])

v0.16.0

03 Jul 01:22
Compare
Choose a tag to compare

✨ New Stuff

  • Relude.Tuple.apply2-apply5 - allows you to apply a normal curried function to a tuple of arguments
(1, 2, 3) |> Relude.Tuple.apply3((a, b, c) => a + b + c) // 6
  • Relude.Function.curry2-curry5 - allows you to convert a function that accepts a tuple of arguments to a normal curried function

See tests for examples

  • Relude.Function.uncurry2-uncurry5 - allows you to convert a normal curried function into a function that accepts a tuple of arguments

See tests for examples

  • Relude.Extensions.ApplyExtensions.mapTuple2-mapTuple5 - adds extension functions to all instances of Apply which allow you to take a tuple of wrapped arguments and apply a pure function to them to produce a wrapped result. Similar to map2-map5, but accepts a tuple of arguments rather than normal curried arguments. Any module that includes ApplyExtensions will now have mapTuple2-5
(Some(1), Some(2), Some(3)) |> Relude.Option.mapTuple3((a, b, c) => a + b + c) // Some(6)

Compared to similar map3:

Relude.Option.map3((a, b, c) => a + b + c, Some(1), Some(2), Some(3)) // Some(6)

v0.15.0

02 Jul 23:35
Compare
Choose a tag to compare

✨ New Stuff

  • Relude.Tuple includes helpers for constructing tuples (from functions of a certain arity or from lists/arrays of a certain size)
  • Relude.Extensions.Ord includes a bunch of functions that come for free if your type can be ordered (e.g. min, max, lessThan, lessThanOrEq, etc). So far only Relude.Float benefits from these new functions, but that will expand to other types in the near future.

🐛 Bug Fixes

  • List.Option.traverse now correctly allows you to map from 'a to some other non-'a type
  • The compiler was assuming == to be the polymorphic runtime equality function a few places where safe equality could be used instead (e.g. when comparing values known to be floats). This has been fixed, and the appropriate compiler warning is now enabled.

v0.14.1

27 Jun 21:29
Compare
Choose a tag to compare

🐛 Bug Fixes

  • Array.prependToAll and List.prependToAll are now tail recursive (and intersperse as well, since it uses prependToAll)