Sha256: e600c97b25da40740281089b731f383eeed83c45ed530e95acbd715cb98bed07
Contents?: true
Size: 1001 Bytes
Versions: 1
Compression:
Stored size: 1001 Bytes
Contents
require 'dry/equalizer' require 'dry/monads/either' require 'dry/monads/maybe' require 'dry/monads/try' module Dry # @api public module Monads extend self # Stores the given value in one of the subtypes of {Maybe} monad. # It is essentially a wrapper for {Maybe.lift}. # # @param value [Object] the value to be stored in the monad # @return [Maybe::Some, Maybe::None] def Maybe(value) Maybe.lift(value) end # @param value [Object] the value to be stored in the monad # @return [Maybe::Some] def Some(value) Maybe::Some.new(value) end # @return [Maybe::None] def None Maybe::Some::None.instance end # @param value [Object] the value to be stored in the monad # @return [Either::Right] def Right(value) Either::Right.new(value) end # @param value [Object] the value to be stored in the monad # @return [Either::Left] def Left(value) Either::Left.new(value) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dry-monads-0.1.0 | lib/dry/monads.rb |