<div dir="ltr">The documentation of monad-validate is indeed great. I didn't know about this package before. I will add it to my list of nice Haskell libraries.<div><br></div><div>Cheers,</div><div>Daniel</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Sa., 4. Jan. 2020 um 20:31 Uhr schrieb Alexis King <<a href="mailto:lexi.lambda@gmail.com">lexi.lambda@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word">You might want to check out <a href="https://hackage.haskell.org/package/monad-validate" target="_blank">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><br></div><div>Disclaimer: I am the author of monad-validate.<br><div><br></div><div>Alexis<br><div><br><blockquote type="cite"><div>On Jan 4, 2020, at 08:58, Debasish Ghosh <<a href="mailto:ghosh.debasish@gmail.com" target="_blank">ghosh.debasish@gmail.com</a>> wrote:</div><br><div><div dir="ltr">Hi -<div><br></div><div>I am not an experienced Haskell programmer and would like to have some help with the following problem ..</div><div><br></div><div>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><br></div><div>validateOpenDate :: ZonedTime -> Validation [String] ZonedTime</div><div><br></div><div>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><br></div><div>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><br></div><div>Any help will be appreciated ..</div><div><br></div><div>regards.<br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr">Debasish Ghosh<br></div></div></div></div></div></blockquote></div><br></div></div></div>_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div>