Defining a property in haskel locally

75 views Asked by At

I have written this property check in haskell:

prop_XY (x,y) sud = ((!!) (rows (sud)) x) !! y

and i need to define this locally, any suggestions on how to do it as i am clueless how to do it?

EDIT

So this is the two prop functions i have, and i need to define the second one locally.

-- Check update function
prop_update (x,y) sud n = prop_XY (x',y') (update sud (x',y') n) == n 
                          where x' = x `mod` 9 
                                y' = y `mod` 9

-- helper to find specific value 
prop_XY (x,y) sud = ((!!) (rows (sud)) x) !! y
1

There are 1 answers

2
AudioBubble On

If I understand you correctly, you can use a where clause:

prop_update ... = ... prop_XY (x,y) ...
  where
    prop_XY (x,y) sud = ((!!) (rows (sud)) x) !! y

See http://learnyouahaskell.com/syntax-in-functions#where for more information.