X-Git-Url: https://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FGrid.hs;h=efa63418947c308e7bed8c25619dadbc8d9d0a8e;hb=ecb77f944fcba8c8cfe60ca782bc5d9c8ab68cf9;hp=1a436acdc00d9276ceb1e25b7080355577822bf3;hpb=cc10c04deda3bdf54867a9052b638f0bc4b09fbe;p=spline3.git diff --git a/src/Grid.hs b/src/Grid.hs index 1a436ac..efa6341 100644 --- a/src/Grid.hs +++ b/src/Grid.hs @@ -4,6 +4,8 @@ module Grid where +import Test.QuickCheck (Arbitrary(..), Gen, Positive(..)) + import Cube (Cube(Cube)) import FunctionValues import Misc (flatten) @@ -20,6 +22,13 @@ data Grid = Grid { h :: Double, -- MUST BE GREATER THAN ZERO! deriving (Eq, Show) +instance Arbitrary Grid where + arbitrary = do + (Positive h') <- arbitrary :: Gen (Positive Double) + fvs <- arbitrary :: Gen [[[Double]]] + return (make_grid h' fvs) + + -- | The constructor that we want people to use. If we're passed a -- non-positive grid size, we throw an error. make_grid :: Double -> [[[Double]]] -> Grid