-- ~\~ language=Haskell filename=src/Test/LessArbitrary/Laws.hs
-- ~\~ begin <<less-arbitrary.md|src/Test/LessArbitrary/Laws.hs>>[0]
{-# language DataKinds             #-}
{-# language FlexibleInstances     #-}
{-# language Rank2Types            #-}
{-# language MultiParamTypeClasses #-}
{-# language ScopedTypeVariables   #-}
{-# language TypeApplications      #-}
{-# language TypeOperators         #-}
{-# language UndecidableInstances  #-}
{-# language AllowAmbiguousTypes   #-}
module Test.LessArbitrary.Laws(
      lessArbitraryLaws
    ) where

import Data.Proxy
import Test.QuickCheck(Gen, property)
import Test.QuickCheck.Classes(Laws(..))
import Test.LessArbitrary
import qualified Data.HashMap.Strict as Map
import           Data.HashMap.Strict(HashMap)

-- ~\~ begin <<less-arbitrary.md|less-arbitrary-laws>>[0]
lessArbitraryLaws :: forall        s a.
                     LessArbitrary s a
                  =>                (a -> Bool)
                  -> Laws
lessArbitraryLaws :: forall s a. LessArbitrary s a => (a -> Bool) -> Laws
lessArbitraryLaws a -> Bool
cheapestPred =
    String -> [(String, Property)] -> Laws
Laws String
"LessArbitrary"
         [(String
"always selects cheapest",
           forall prop. Testable prop => prop -> Property
property forall a b. (a -> b) -> a -> b
$
             (forall s a. LessArbitrary s a => (a -> Bool) -> Gen Bool
prop_alwaysCheapest @s @a) a -> Bool
cheapestPred)]

prop_alwaysCheapest :: forall s a.
                       LessArbitrary s a
                    =>                (a -> Bool)
                    -> Gen                  Bool
prop_alwaysCheapest :: forall s a. LessArbitrary s a => (a -> Bool) -> Gen Bool
prop_alwaysCheapest a -> Bool
cheapestPred =
  a -> Bool
cheapestPred forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (forall s a. StartingState s => Int -> CostGen s a -> Gen a
withCost @s @a) Int
0 forall s a. LessArbitrary s a => CostGen s a
lessArbitrary
-- ~\~ end
-- ~\~ end