Last active
August 30, 2016 05:53
-
-
Save dorchard/7ed17c66677a64d069ff to your computer and use it in GitHub Desktop.
My QuickCheck instance for Data.Matrix (square matrices)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
instance (Arbitrary a) => Arbitrary (Matrix a) where | |
-- NB: for square matrices | |
arbitrary = sized (\n -> do xs <- vectorOf (n*n) arbitrary | |
return $ matrix n n (\(i, j) -> xs !! ((i-1)*n + (j-1)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment