From: Michael Orlitzky Date: Tue, 25 Oct 2011 03:53:27 +0000 (-0400) Subject: Add bang patterns for the cube_at function (Ben Lippmeier). X-Git-Tag: 0.0.1~88 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=56e68abc1d03f1991f45365b4adc5b0bc4f05996;p=spline3.git Add bang patterns for the cube_at function (Ben Lippmeier). --- diff --git a/src/Grid.hs b/src/Grid.hs index ca66437..71e39a0 100644 --- a/src/Grid.hs +++ b/src/Grid.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE BangPatterns #-} -- | The Grid module just contains the Grid type and two constructors -- for it. We hide the main Grid constructor because we don't want -- to allow instantiation of a grid with h <= 0. @@ -65,7 +66,7 @@ make_grid grid_size values -- centered on that position. If there is no cube there (i.e. the -- position is outside of the grid), it will throw an error. cube_at :: Grid -> Int -> Int -> Int -> Cube -cube_at g i j k +cube_at !g !i !j !k | i < 0 = error "i < 0 in cube_at" | i >= xsize = error "i >= xsize in cube_at" | j < 0 = error "j < 0 in cube_at"