hsExprTest-3.6.5: Expression Testing
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.QuickCheck.Literal

Description

Defines newtypes for strings and integers that can be used to generate constants. The concrete value of the constant is encoded in the type, e.g., 'StringConst "hi!"' will always generate string "hi!" using arbitrary. It is expected the values will be coerced to the underlying data type before use using coerce or fromConst. Converting to IntConst or StrConst using Coercible is undefined behaviour unless the actual value matches the value in the type.

Synopsis

Documentation

newtype IntConst (n :: Nat) (i :: Type) #

The data constructor should not be used, can be only created by arbitrary or def

Constructors

IntConst i 

Instances

Instances details
(KnownNat n, Integral i) => Arbitrary (IntConst n i) #

Generates the single value encoded in the type, does not shrink.

Instance details

Defined in Test.QuickCheck.Literal

Methods

arbitrary :: Gen (IntConst n i)

shrink :: IntConst n i -> [IntConst n i]

(KnownNat n, Integral i, Show i) => Show (IntConst n i) # 
Instance details

Defined in Test.QuickCheck.Literal

Methods

showsPrec :: Int -> IntConst n i -> ShowS

show :: IntConst n i -> String

showList :: [IntConst n i] -> ShowS

(KnownNat n, Integral i) => Default (IntConst n i) # 
Instance details

Defined in Test.QuickCheck.Literal

Methods

def :: IntConst n i

(KnownNat n, Integral i) => Eq (IntConst n i) #

(==) always returns True, IntConst is a singleton type.

Instance details

Defined in Test.QuickCheck.Literal

Methods

(==) :: IntConst n i -> IntConst n i -> Bool

(/=) :: IntConst n i -> IntConst n i -> Bool

(KnownNat n, Integral i) => FromConst (IntConst n i) # 
Instance details

Defined in Test.QuickCheck.Literal

Associated Types

type ConstRep (IntConst n i) #

Methods

fromConst :: IntConst n i -> ConstRep (IntConst n i) #

type ConstRep (IntConst n i) # 
Instance details

Defined in Test.QuickCheck.Literal

type ConstRep (IntConst n i) = i

newtype StrConst (sym :: Symbol) (str :: Type) #

The data constructor should not be used, can be only created by arbitrary or def

Constructors

StrConst str 

Instances

Instances details
(KnownSymbol sym, IsString str) => Arbitrary (StrConst sym str) #

Generates the single value encoded in the type, does not shrink.

Instance details

Defined in Test.QuickCheck.Literal

Methods

arbitrary :: Gen (StrConst sym str)

shrink :: StrConst sym str -> [StrConst sym str]

(KnownSymbol sym, IsString str, Show str) => Show (StrConst sym str) # 
Instance details

Defined in Test.QuickCheck.Literal

Methods

showsPrec :: Int -> StrConst sym str -> ShowS

show :: StrConst sym str -> String

showList :: [StrConst sym str] -> ShowS

(KnownSymbol sym, IsString str) => Default (StrConst sym str) # 
Instance details

Defined in Test.QuickCheck.Literal

Methods

def :: StrConst sym str

(KnownSymbol sym, IsString str) => Eq (StrConst sym str) #

(==) always returns True, IntConst is a singleton type.

Instance details

Defined in Test.QuickCheck.Literal

Methods

(==) :: StrConst sym str -> StrConst sym str -> Bool

(/=) :: StrConst sym str -> StrConst sym str -> Bool

(KnownSymbol sym, IsString str) => FromConst (StrConst sym str) # 
Instance details

Defined in Test.QuickCheck.Literal

Associated Types

type ConstRep (StrConst sym str) #

Methods

fromConst :: StrConst sym str -> ConstRep (StrConst sym str) #

type ConstRep (StrConst sym str) # 
Instance details

Defined in Test.QuickCheck.Literal

type ConstRep (StrConst sym str) = str

type StringConst (sym :: Symbol) = StrConst sym String #

class FromConst c where #

Associated Types

type ConstRep c :: Type #

Methods

fromConst :: c -> ConstRep c #

Instances

Instances details
(KnownNat n, Integral i) => FromConst (IntConst n i) # 
Instance details

Defined in Test.QuickCheck.Literal

Associated Types

type ConstRep (IntConst n i) #

Methods

fromConst :: IntConst n i -> ConstRep (IntConst n i) #

(KnownSymbol sym, IsString str) => FromConst (StrConst sym str) # 
Instance details

Defined in Test.QuickCheck.Literal

Associated Types

type ConstRep (StrConst sym str) #

Methods

fromConst :: StrConst sym str -> ConstRep (StrConst sym str) #