Releases: dry-rb/dry-monads
Releases · dry-rb/dry-monads
v0.4.0
v0.4.0 2017-11-11
Changed
- The
Either
monad was renamed toResult
which sounds less nerdy but better reflects the purpose of the type.Either::Right
becameResult::Success
andEither::Left
becameResult::Failure
. This change is backward-compatible overall but you will see the new names when using oldLeft
andRight
methods (citizen428) - Consequently,
Try::Success
andTry::Failure
were renamed toTry::Value
andTry::Error
(flash-gordon)
Added
Try#or
, works asResult#or
(flash-gordon)Maybe#success?
andMaybe#failure?
(aliases for#some?
and#none?
) (flash-gordon)Either#flip
inverts aResult
value (flash-gordon)List#map
called without a block returns anEnumerator
object (flash-gordon)- Right-biased monads (
Maybe
,Result
, andTry
) now implement the===
operator which is used for equality checks in thecase
statement (flash-gordon)case value when Some(1..100) then :ok when Some { |x| x < 0 } then :negative when Some(Integer) then :invalid else raise TypeError end
Deprecated
- Direct accessing
value
on right-biased monads has been deprecated, use thevalue!
method instead.value!
will raise an exception if it is called on a Failure/None/Error instance (flash-gordon)
v0.3.1
v0.3.0
Added
- Added
Either#either
that accepts two callbacks, runs the first if it isRight
and the second otherwise (nkondratyev) - Added
#fmap2
and#fmap3
for mapping over nested structures likeList Either
andEither Some
(flash-gordon) - Added
Try#value_or
(dsounded) - Added the
List
monad which acts as an immutableArray
and plays nice with other monads. A common example is a list ofEither
s (flash-gordon) #bind
made to work with keyword arguments as extra parameters to the block (flash-gordon)- Added
List#traverse
that "flips" the list with an embedded monad (flash-gordon + damncabbage) - Added
#tee
for all right-biased monads (flash-gordon)