1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00

Make sure we match Rationals in liftNumeric.

This commit is contained in:
Patrick Thomson 2018-03-13 20:55:46 -04:00
parent ca96b02869
commit 0d248e2aab

View File

@ -140,8 +140,9 @@ instance ( MonadAddressable location (Value location term) m
| otherwise = fail ("not defined for non-boolean conditions: " <> show cond)
liftNumeric f arg
| Just (Integer (Whole i)) <- prjValue arg = integer $ f i
| Just (Value.Float (Decim d)) <- prjValue arg = float $ f d
| Just (Integer (Whole i)) <- prjValue arg = integer $ f i
| Just (Value.Float (Decim d)) <- prjValue arg = float $ f d
| Just (Value.Rational (Ratio r)) <- prjValue arg = rational $ f r
| otherwise = fail ("Invalid operand to liftNumeric: " <> show arg)
liftNumeric2 f left right