Parsing Ratio with zero denominator

Dannyu NDos ndospark320 at gmail.com
Sun May 31 08:06:09 UTC 2020


I mean, shouldn't there be a guard?

instance (Integral a, Read a) => ReadPrec (Ratio a) where
readPrec = parens . prec 7 $ do
n <- step readPrec
lift (expect (Symbol "%"))
d <- step readPrec
*guard (**0 /= d)*
return (n % d)

2020년 5월 31일 (일) 오후 12:13, Dannyu NDos <ndospark320 at gmail.com>님이 작성:

> Shouldn't the parser be pfail rather than throwing an error?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20200531/78838650/attachment.html>


More information about the Libraries mailing list