@@ -24,7 +24,7 @@ module Language.Granule.Runtime
2424 -- Re-exported from Prelude
2525 , String , Int , IO , Float , Maybe (.. ), Show (.. ), Char , getLine
2626 , putStr , read , (<$>) , fromIntegral , Monad (.. )
27- , ($) , error , (>) , (++) , id , Num (.. ), (.)
27+ , ($) , error , (>= ) , (++) , id , Num (.. ), (.)
2828 , pack , Text
2929 ) where
3030
@@ -39,7 +39,7 @@ import Criterion.Main ( defaultMain, bench, bgroup, nfAppIO )
3939import System.IO.Silently ( silence )
4040import Prelude
4141 ( Int , IO , Double , Maybe (.. ), Show (.. ), Char , read , fromEnum , toEnum
42- , (<$>) , (<>) , fromIntegral , ($) , error , (>) , (++) , id , Num (.. ), (.) )
42+ , (<$>) , (<>) , fromIntegral , ($) , error , (>= ) , (++) , id , Num (.. ), (.) )
4343import Control.Monad
4444import GHC.Err (undefined )
4545import Data.Function (const )
@@ -183,8 +183,8 @@ writeFloatArray a i v = unsafePerformIO $ writeFloatArraySafe a i v
183183
184184writeFloatArraySafe :: FloatArray -> Int -> Float -> IO FloatArray
185185writeFloatArraySafe a i v =
186- if i > grLength a
187- then error $ " array index out of bounds: " ++ show i ++ " > " ++ show (grLength a)
186+ if i >= grLength a
187+ then error $ " array index out of bounds: " ++ show i ++ " >= " ++ show (grLength a)
188188 else case a of
189189 HaskellArray {} -> error " expected unique array"
190190 PointerArray len ptr -> do
@@ -197,8 +197,8 @@ writeFloatArrayI a i v = unsafePerformIO $ writeFloatArrayISafe a i v
197197
198198writeFloatArrayISafe :: FloatArray -> Int -> Float -> IO FloatArray
199199writeFloatArrayISafe a i v =
200- if i > grLength a
201- then error $ " array index out of bounds: " ++ show i ++ " > " ++ show (grLength a)
200+ if i >= grLength a
201+ then error $ " array index out of bounds: " ++ show i ++ " >= " ++ show (grLength a)
202202 else case a of
203203 PointerArray {} -> error " expected non-unique array"
204204 HaskellArray len arr -> do
@@ -231,8 +231,8 @@ readFloatArray a i = unsafePerformIO $ readFloatArraySafe a i
231231
232232readFloatArraySafe :: FloatArray -> Int -> IO (Float , FloatArray )
233233readFloatArraySafe a i =
234- if i > grLength a
235- then error $ " readFloatArray index out of bounds: " ++ show i ++ " > " ++ show (grLength a)
234+ if i >= grLength a
235+ then error $ " readFloatArray index out of bounds: " ++ show i ++ " >= " ++ show (grLength a)
236236 else case a of
237237 HaskellArray {} -> error " expected unique array"
238238 PointerArray len ptr -> do
@@ -245,8 +245,8 @@ readFloatArrayI a i = unsafePerformIO $ readFloatArrayISafe a i
245245
246246readFloatArrayISafe :: FloatArray -> Int -> IO (Float , FloatArray )
247247readFloatArrayISafe a i =
248- if i > grLength a
249- then error $ " readFloatArrayI index out of bounds: " ++ show i ++ " > " ++ show (grLength a)
248+ if i >= grLength a
249+ then error $ " readFloatArrayI index out of bounds: " ++ show i ++ " >= " ++ show (grLength a)
250250 else case a of
251251 PointerArray {} -> error " expected non-unique array"
252252 HaskellArray _ arr -> do
@@ -360,4 +360,4 @@ type instance CapabilityType 'TimeDateTag = () -> Text
360360{-# NOINLINE cap #-}
361361cap :: Capability cap -> () -> CapabilityType cap
362362cap Console () = \ x -> unsafePerformIO $ toStdout $ x
363- cap TimeDate () = \ () -> unsafePerformIO $ timeDate ()
363+ cap TimeDate () = \ () -> unsafePerformIO $ timeDate ()
0 commit comments