Hey guys i'm pretty fresh to dry monads and i've got a question about
fmap. Lets suppose i've got code like this:
validate.fmap do |valid_attributes| form.save.fmap do |valid_postcard| mailer.send_postcard(to_email: email, postcard: valid_postcard).deliver_now valid_postcard end end
Right. Is there a way to chain both those functions so they return
Right at the end of the chain? Now, when
form.save returns Left at the end of the day I have
Am I doing something wrong? Is there a way to make it chainable?
def inherited(subclass) subclass.instance_variable_set(:"@container", Marshal.load(Marshal.dump(_container))) end