<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">You might want to check out <a href="https://hackage.haskell.org/package/monad-validate" class="">https://hackage.haskell.org/package/monad-validate</a>, which provides a monad transformer version of a Validation-like type. You can stack it on top of IO and do whatever you want there. Errors are collected from multiple branches as long as you use applicative operations where possible, so you probably want to use ApplicativeDo. The monad laws are satisfied via a relaxed notion of equality; see the documentation for more info.<div class=""><br class=""></div><div class="">Disclaimer: I am the author of monad-validate.<br class=""><div class=""><br class=""></div><div class="">Alexis<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jan 4, 2020, at 08:58, Debasish Ghosh <<a href="mailto:ghosh.debasish@gmail.com" class="">ghosh.debasish@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi -<div class=""><br class=""></div><div class="">I am not an experienced Haskell programmer and would like to have some help with the following problem ..</div><div class=""><br class=""></div><div class="">I am trying to validate a bunch of inputs and found the package Data.Validation. I am also using Data.Time for date and time. I have a function like this ..</div><div class=""><br class=""></div><div class="">validateOpenDate :: ZonedTime -> Validation [String] ZonedTime</div><div class=""><br class=""></div><div class="">It's supposed to validate a date for which I need to fetch the current date and time. I can do that with getZonedTime :: IO ZonedTime. I want to check if the current time is less than the date time I pass to the function and return an appropriate Validation.</div><div class=""><br class=""></div><div class="">The question is how do I lift the result from IO into the Validation ? Or is there any alternative strategy that I should consider for this validation ? I have a number of other validations which follow the same strategy but don't have the IO. My final goal is to be able to compose all these validations applicatively to prepare a final ADT in a smart constructor.</div><div class=""><br class=""></div><div class="">Any help will be appreciated ..</div><div class=""><br class=""></div><div class="">regards.<br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class="">Debasish Ghosh<br class=""></div></div></div></div></div></blockquote></div><br class=""></div></div></body></html>