
31 May
2020
31 May
'20
8:06 a.m.
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
Shouldn't the parser be pfail rather than throwing an error?