Read (Ratio a) should also parse a decimal point literal

6 Feb
2020
6 Feb
'20
3:44 a.m.
Given a string representing a decimal point literal (ex. "0.25"), the number it represents is guaranteed to be rational. It seems appropriate for Ratio to parse such strings. readDecimalRatio :: (Integral a, Read a) => ReadPrec (Ratio a) readDecimalRatio = parens $ do Number x <- lexP return (numberToRational x) Combine this by (+++) with the original `readPrec` from the instance Read Ratio.
1978
Age (days ago)
1978
Last active (days ago)
0 comments
1 participants
participants (1)
-
Dannyu NDos