accelerate-blas-0.1.0.0: test/Hedgehog/Gen/Shape.hs
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeOperators #-}
module Hedgehog.Gen.Shape where
import Data.Array.Accelerate as A
import Hedgehog ( Gen, Range )
import Hedgehog.Gen ( int )
-- Generate a randomly sized shape of the given dimensionality
--
class GenShape sh where
genShape :: Monad m => Range Int -> Gen sh
instance GenShape Z where
genShape _ = return Z
instance GenShape sh => GenShape (sh :. Int) where
genShape r = (:.) <$> genShape r <*> int r