These are chat archives for dry-rb/chat

10th
Dec 2018
Jules Ivanic
@guizmaii
Dec 10 2018 17:26

Hi everyone,

I’m using the Task monad and I saw that there’s a pure function but there’s not its “dual” failed (equivalent of Concurent::Promise.reject).

How would you implement it ?

I don’t want to throw exception. Just create an immedialty failed Task
(throwing is expensive in JRuby)

is this something sensible:

    def failed(error)
      Dry::Monads::Task.new(Concurrent::Promise.reject(error))
    end

???

This message was deleted