summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Grasp/Types/Instruction.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Grasp/Types/Instruction.hs b/src/Grasp/Types/Instruction.hs
index e618222..f00d2df 100644
--- a/src/Grasp/Types/Instruction.hs
+++ b/src/Grasp/Types/Instruction.hs
@@ -32,5 +32,10 @@ toFloat :: Instruction -> Maybe Float
toFloat (Instruction i) = readMaybe i
toInt :: Instruction -> Maybe Int
-toInt (Instruction i) = readMaybe i
+toInt (Instruction i) = do
+ f <- (readMaybe :: String -> Maybe Float) i
+ let g = round f
+ h = fromIntegral g
+ r <- if (f == h) then Just g else Nothing
+ return r