@@ -315,10 +315,12 @@ class Integral a where
315315
316316-- ---------------------------------------------------------------- [ Integers ]
317317divBigInt : Integer -> Integer -> Integer
318−divBigInt = prim__sdivBigInt
318+divBigInt x y = case y == 0 of
319+ False => prim__sdivBigInt x y
319320
320321modBigInt : Integer -> Integer -> Integer
321−modBigInt = prim__sremBigInt
322+modBigInt x y = case y == 0 of
323+ False => prim__sremBigInt x y
322324
323325instance Integral Integer where
324326 div = divBigInt
@@ -327,10 +329,12 @@ instance Integral Integer where
327329-- --------------------------------------------------------------------- [ Int ]
328330
329331divInt : Int -> Int -> Int
330−divInt = prim__sdivInt
332+divInt x y = case y == 0 of
333+ False => prim__sdivInt x y
331334
332335modInt : Int -> Int -> Int
333−modInt = prim__sremInt
336+modInt x y = case y == 0 of
337+ False => prim__sremInt x y
334338
335339instance Integral Int where
336340 div = divInt
@@ -338,10 +342,12 @@ instance Integral Int where
338342
339343-- ------------------------------------------------------------------- [ Bits8 ]
340344divB8 : Bits8 -> Bits8 -> Bits8
341−divB8 = prim__sdivB8
345+divB8 x y = case y == 0 of
346+ False => prim__sdivB8 x y
342347
343348modB8 : Bits8 -> Bits8 -> Bits8
344−modB8 = prim__sremB8
349+modB8 x y = case y == 0 of
350+ False => prim__sremB8 x y
345351
346352instance Integral Bits8 where
347353 div = divB8
@@ -349,10 +355,12 @@ instance Integral Bits8 where
349355
350356-- ------------------------------------------------------------------ [ Bits16 ]
351357divB16 : Bits16 -> Bits16 -> Bits16
352−divB16 = prim__sdivB16
358+divB16 x y = case y == 0 of
359+ False => prim__sdivB16 x y
353360
354361modB16 : Bits16 -> Bits16 -> Bits16
355−modB16 = prim__sremB16
362+modB16 x y = case y == 0 of
363+ False => prim__sremB16 x y
356364
357365instance Integral Bits16 where
358366 div = divB16
@@ -360,10 +368,12 @@ instance Integral Bits16 where
360368
361369-- ------------------------------------------------------------------ [ Bits32 ]
362370divB32 : Bits32 -> Bits32 -> Bits32
363−divB32 = prim__sdivB32
371+divB32 x y = case y == 0 of
372+ False => prim__sdivB32 x y
364373
365374modB32 : Bits32 -> Bits32 -> Bits32
366−modB32 = prim__sremB32
375+modB32 x y = case y == 0 of
376+ False => prim__sremB32 x y
367377
368378instance Integral Bits32 where
369379 div = divB32
@@ -371,10 +381,12 @@ instance Integral Bits32 where
371381
372382-- ------------------------------------------------------------------ [ Bits64 ]
373383divB64 : Bits64 -> Bits64 -> Bits64
374−divB64 = prim__sdivB64
384+divB64 x y = case y == 0 of
385+ False => prim__sdivB64 x y
375386
376387modB64 : Bits64 -> Bits64 -> Bits64
377−modB64 = prim__sremB64
388+modB64 x y = case y == 0 of
389+ False => prim__sremB64 x y
378390
379391instance Integral Bits64 where
380392 div = divB64