module Clash.Hedgehog.Annotations.SynthesisAttributes where

import Clash.Annotations.SynthesisAttributes (Attr(..))

import Hedgehog
import qualified Hedgehog.Gen as Gen

genAttr :: forall m. MonadGen m => Range Int -> m (Attr String)
genAttr :: Range Int -> m (Attr String)
genAttr Range Int
range =
  [m (Attr String)] -> m (Attr String)
forall (m :: Type -> Type) a. MonadGen m => [m a] -> m a
Gen.choice
    [ String -> Bool -> Attr String
forall a. a -> Bool -> Attr a
BoolAttr (String -> Bool -> Attr String)
-> m String -> m (Bool -> Attr String)
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$> m String
genAlphaNum m (Bool -> Attr String) -> m Bool -> m (Attr String)
forall (f :: Type -> Type) a b.
Applicative f =>
f (a -> b) -> f a -> f b
<*> m Bool
forall (m :: Type -> Type). MonadGen m => m Bool
Gen.bool
    , String -> Integer -> Attr String
forall a. a -> Integer -> Attr a
IntegerAttr (String -> Integer -> Attr String)
-> m String -> m (Integer -> Attr String)
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$> m String
genAlphaNum m (Integer -> Attr String) -> m Integer -> m (Attr String)
forall (f :: Type -> Type) a b.
Applicative f =>
f (a -> b) -> f a -> f b
<*> m Integer
genInteger
    , String -> String -> Attr String
forall a. a -> a -> Attr a
StringAttr (String -> String -> Attr String)
-> m String -> m (String -> Attr String)
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$> m String
genAlphaNum m (String -> Attr String) -> m String -> m (Attr String)
forall (f :: Type -> Type) a b.
Applicative f =>
f (a -> b) -> f a -> f b
<*> m String
genAlphaNum
    , String -> Attr String
forall a. a -> Attr a
Attr (String -> Attr String) -> m String -> m (Attr String)
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$> m String
genAlphaNum
    ]
 where
  genAlphaNum :: m String
genAlphaNum = Range Int -> m Char -> m String
forall (m :: Type -> Type).
MonadGen m =>
Range Int -> m Char -> m String
Gen.string Range Int
range m Char
forall (m :: Type -> Type). MonadGen m => m Char
Gen.alphaNum
  genInteger :: m Integer
genInteger  = Int -> Integer
forall a. Integral a => a -> Integer
toInteger (Int -> Integer) -> m Int -> m Integer
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Int -> m Int
forall (m :: Type -> Type) a.
(MonadGen m, Integral a) =>
Range a -> m a
Gen.integral Range Int
range