1
1
mirror of https://github.com/github/semantic.git synced 2024-12-30 10:27:45 +03:00

Revert "Try catching ArithExceptions"

This reverts commit 93fb061a3b99b6f8ea7ea3bb50104233bf900e14.
This commit is contained in:
joshvera 2018-04-23 19:33:07 -04:00
parent 204a0918e7
commit b087d7255c

View File

@ -6,7 +6,6 @@ import Data.Abstract.Number (liftIntegralFrac, liftReal, liftedExponent, liftedF
import Data.Fixed
import Diffing.Algorithm
import Prologue
import System.IO.Unsafe (unsafePerformIO)
-- | Typical prefix function application, like `f(x)` in many languages, or `f x` in Haskell.
data Call a = Call { callContext :: ![a], callFunction :: !a, callParams :: ![a], callBlock :: !a }
@ -61,7 +60,7 @@ instance Ord1 Arithmetic where liftCompare = genericLiftCompare
instance Show1 Arithmetic where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Arithmetic where
eval = traverse subtermValue >=> (\term -> unsafePerformIO (catch (pure $ go term) (\(_ :: ArithException) -> pure hole))) where
eval = traverse subtermValue >=> go where
go (Plus a b) = liftNumeric2 add a b where add = liftReal (+)
go (Minus a b) = liftNumeric2 sub a b where sub = liftReal (-)
go (Times a b) = liftNumeric2 mul a b where mul = liftReal (*)