Skip to content

Releases: reazen/relude

v0.49.0

06 Jan 17:24
Compare
Choose a tag to compare

Thanks to contributors!

✨ New

  • @utkarshkukreti New functions for Array/List:
    • insertAt - inserts an element at an index, shifting the following elements down
    • updateAt - modifies an element at an index using a function
    • swapAt - swaps the values at two indices

✔️ Tests

  • @jihchi - Greatly improved test coverage for various modules

v0.48.0

31 Dec 21:53
Compare
Choose a tag to compare

✨ New

  • Added extension module functors for ENUM and BOUNDED_ENUM, inspired by purescript-enums
    • fromToAsList - generate a list of enum values from a start value to an end value
    • upFromAsList - generate a list of enum values starting from (but not including) a start value
    • upFromIncludingAsList - generate a list of enum values starting from (and including) a start value
    • downFromAsList - generate a list of enums down from (but not including) a start value
    • downFromIncludingAsList - generate a list of enums down from (and including) a start value
    • See https://github.com/reazen/relude/blob/master/__tests__/extensions/Relude_Extensions_Enum_test.re for example usage

v0.47.0

31 Dec 05:07
Compare
Choose a tag to compare

✨ New

  • @jihchi - unit tests and documentation updates! Thanks!
  • Relude.Bool
    • Added typeclass instance for BsAbstract.Interface.BOUNDED typeclass
    • Added typeclass instance for Relude_Interface.ENUM typeclass
    • Added typeclass instance for Relude_Interface_BOUNDED_ENUM typeclass
  • Relude.Eq
    • Added new module for functions having to do with Eq
    • Added by function - the contravariant map for the ('a, 'a) => bool equality function
      • Given a function ('a, 'a) => bool, and a function 'b => 'a, returns a new equality function for ('b, 'b) => bool
    • Added typeclass instances for BsAbstract.Interface.CONTRAVARIANT for ('a, 'a) => bool function
    • Added invert function for inverting an ('a, 'a) => bool equality function
  • Relude.Int
    • Added typeclass instances for BOUNDED and ENUM
  • Relude.Interface
    • Added typeclass module type ARROW for capturing a type a, a type b, and a function a => b
    • Added typeclass module type functor ARROW_F for capturing two types, and returning an ARROW for the types
    • Added LOWER_BOUNDED typeclass for representing a type with a lower bound (e.g. string has "" as a lower bound)
    • Added UPPER_BOUNDED typeclass for representing a type with an upper bound
    • Added ENUM typeclass for representing a type that can be enumerated
    • Added BOUNDED_ENUM typeclass for representing a type that can be enumerated, and has an upper and lower bound
  • Relude.Ord
    • Added module for working with comparison functions of the form ('a, 'a) => BsAbstract.Interface.ordering
    • by function is the contravariant map for the compare function
    • Added CONTRAVARIANT instance for the compare function using by
    • Added reverse function for reversing the order of a compare function
    • Moved a bunch of loose helper function from Relude_Extensions_Ord to Relude_Ord - these are now used by Relude_Extensions_Ord
  • Relude_Ordering
    • Added a module for working with the BsAbstract.Interface.ordering type - the polymorphic variant that contains inhabitants equal_to, greater_than, and less_than
    • Various helper functions and typeclass instances for working with values of type ordering
  • Relude_Tuple
    • Split up the Tuple module into submodules Relude.Tuple2, etc.
    • Added helper functions and module functors for creating Eq and Ord instances for types that can be converted to a tuple
  • Relude_Unit
    • Added module for dealing with unit values
    • Various helper functions and typeclasses
  • Relude_Extensions_Eq
    • Added functions and modules for inverting equality functions/Eq modules
    • Added functions/module functors for creating Eq modules in terms of other Eq modules (via the CONTRAVARIANT nature of EQ)
  • Relude_Extensions_Ord
    • Added functions and modules for reversing comparison functions/Ord modules
    • Added functions/module functors for creating Eq modules in terms of other Eq modules (via the CONTRAVARIANT nature of EQ)
  • Relude_Extensions_Show
    • Added some basic helpers for Show modules

🚨 Breaking

  • Changed Relude_Extensions_Ord.Named module to Relude_Extensions_Ord.OrdNamed
    • Attn: @johnhaley81
    • Any module that defines its own Ord module and includes Relude_Extensions_Ord and that used to access comparison functions using the Named module, should now use OrdNamed.
    • This was done to avoid possible naming conflicts with multiple extension modules wanting use provide a module of functions with named/labelled parameters.
    • Fix: change uses of Named coming from OrdExtensions to OrdNamed

✔️ Code quality

  • New and/or improved test coverage for
    • Bool
    • Eq
    • Float
    • Ord
    • Tuple
    • Unit
    • Extensions.Eq
    • Extensions.Ord

🤔 Who cares?

TODO

v0.46.0

19 Dec 23:43
Compare
Choose a tag to compare

v0.45.0

19 Dec 16:03
Compare
Choose a tag to compare

✨ New

v0.44.0

16 Dec 05:28
Compare
Choose a tag to compare

✨ New

  • Add a non-empty, multi-way "rose" tree module Relude_Tree
  • Inspired by many similar implementations in Haskell/Purescript/Elm

v0.43.0

12 Dec 23:49
Compare
Choose a tag to compare

✨ New stuff

  • Option.Ord is available if the inner type is a member of Ord (similar to how Option.Eq works)
  • Option.String, Option.Int and Option.Float specializations now all come with Ord support

🐛 Bug fixes

  • The recently-added Option.Eq helper had the wrong type in its signature (list('a), almost as if I copied-and-pasted it from somewhere...)

v0.42.0

12 Dec 05:00
Compare
Choose a tag to compare

✔️ Code quality

  • Attempt to fix inadvertent shadowing warnings caused by re-aliasing functions/operators/modules in some of the Relude library modules #205

🚨 Possible breaking changes

The above change may cause breakages if you happened to be using one of these aliased modules like Relude.IO.Result, or relying on the fact that some of the Relude modules had re-aliased the >>/<< operators from Relude_Function.Infix.

To fix these issues, just reference the function/module from the proper place, or add a open Relude.Function.Infix at the top of your module.

v0.41.0

10 Dec 17:18
Compare
Choose a tag to compare

✨ New

Free monad

  • Added Relude_Free_Monad - a very basic free monad module functor
  • This is just an initial cut - the goal is to add things to this over time as needed/requested
  • See code and tests for more information

v0.40.0

09 Dec 22:01
Compare
Choose a tag to compare

✨ New

Parallel semantics for IO APPLY

  • Implement parallel execution semantics for the IO APPLY typeclass! 🎆
  • Anything that uses an APPLY-based parallelization (apply, map2-5, tuple2-5, mapTuple2-5, all, traverse/sequence, etc.) should now execute the IO operations in parallel rather than sequential.
    • You shouldn't have to change anything - it should just now be parallel when run
  • This was implemented by adding a new Apply constructor to IO, to go along with the Map and FlatMap constructors
  • Prior to this change the IO apply function was implemented in terms of flatMap, which is why it had the sequential execution semantics. Adding Apply allows for parallel semantics.

IO unsafeRunAsyncPar2 and 3

  • Added unsafeRunAsyncPar2 and 3 functions for IO
  • These are used internally to implement the paralell semantics of IO's Apply, so it's better to use apply-based combinators to compose parallel IO values, rather than manually running them using these.
  • That said, if people find these useful, we can add more, like up to the usual 5, or more!

compose function for IO, Result and Option

  • Added a compose function for the above types, which allow you to compose two functions that are each wrapped inside their own functor contexts.
let rec compose:
  'a 'b 'c 'e.
  (t('b => 'c, 'e), t('a => 'b, 'e)) => t('a => 'c, 'e) = ...

let (<<<) = compose;

let andThen:
  'a 'b 'c 'e.
  (t('a => 'b, 'e), t('b => 'c, 'e)) => t('a => 'c, 'e) = ...

let (>>>) = andThen;
  • This was useful for implementing some of the IO pattern matching with the addition of Apply
  • I also made IO, Result, and Option implement Semigroupoid instances using the above compose functions. I'm not 100% sure if this is a valid thing to do, but it seemed reasonable. Happy to be corrected if this is invalid (and at some point we need to add property-based tests).

🚨 Breaking

  • A small breaking change to IO.withDelay - I realized that withDelay was actually creating a new IO that put the delay before the input IO, so I changed this to split the withDelay function into two different versions:

    • withDelayAfter - creates a new IO which when run, will execute the given IO first, then add the delay
    • withDelay - alias for withDelayAfter
    • withDelayBefore - creates a new IO which when run, will execute the delay, then the given IO

The breaking change is that withDelay used to work more like withDelayBefore, but now is just an alias for withDelayAfter. The end result of each of these is the same, they just put the delay at either the start or the end of the IO operation

🗣️ Request for feedback

This change to IO Apply has not been tested super thoroughly other than some high-level unit tests and some production use cases in our app, so I'd love to hear from anyone as to whether the parallel behavior is working for you, or if you encounter any new problems. If you adopt this version of relude in an existing app, I'd recommend exercising all parts of your app which use IO to make sure there are no regressions.

If you do find regressions, I'd recommend reverting the version of relude for now, and I can try to look into specific cases. If you encounter issues, I'd appreciate minimal reproduction test cases, but any sort of issue description would be appreciated. The most useful information is just a description of what IO combinators you're using, and the order in which they are being used (i.e. "we are doing an async, followed by flatMap, apply, summonError, etc.").