Hoogle Search

Within LTS Haskell 24.66 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. onpagehide :: AttributeValue -> Attribute

    blaze-html Text.Blaze.XHtml5.Attributes

    Combinator for the onpagehide attribute. Example:

    div ! onpagehide "bar" $ "Hello."
    
    Result:
    <div onpagehide="bar">Hello.</div>
    

  2. width :: AttributeValue -> Attribute

    blaze-html Text.Blaze.XHtml5.Attributes

    Combinator for the width attribute. Example:

    div ! width "bar" $ "Hello."
    
    Result:
    <div width="bar">Hello.</div>
    

  3. package genvalidity

    Testing utilities for the validity library Note: There are companion instance packages for this library:

  4. module Data.GenValidity

    GenValid exists to make tests involving Validity types easier and speed up the generation of data for them. To implement tests for this datatype, we would have to be able to generate both primes. We could do this with a generator like this one:

    (Prime <$> 'arbitrary') `suchThat` isValid
    
    However, this is tedious and inefficient, as well as quite naive (because arbitrary tends to use very naive generators). The GenValid type class allows you to specify how to (efficiently) generate valid data of the given type to allow for easier and quicker testing. The default implementation of GenValid already gives you a generator and shrinking function for free:
    instance GenValid Prime
    
    For example, to generate primes, we don't have to consider even numbers other than 2. A more efficient implementation could then look as follows:
    instance GenValid Prime where
    genValid = Prime <$>
    (oneof
    [ pure 2
    , ((\y -> 2 * abs y + 1) <$> arbitrary) `suchThat` isPrime)
    ])
    
    Typical examples of tests involving validity could look as follows:
    it "succeeds when given valid input" $ do
    forAllValid $ \input ->
    myFunction input `shouldSatisfy` isRight
    
    it "produces valid output when it succeeds" $ do
    forAllValid $ \input ->
    case myFunction input of
    Nothing -> return () -- Can happen
    Just output -> output `shouldSatisfy` isValid
    
    Definitely also look at the companion packages for more info on how to use this package.

  5. class GGenValid (f :: Type -> Type)

    genvalidity Data.GenValidity

    No documentation available.

  6. class GValidRecursivelyShrink (f :: Type -> Type)

    genvalidity Data.GenValidity

    No documentation available.

  7. class GValidSubterms (f :: Type -> Type) a

    genvalidity Data.GenValidity

    No documentation available.

  8. class GValidSubtermsIncl (f :: Type -> Type) a

    genvalidity Data.GenValidity

    No documentation available.

  9. class Validity a => GenValid a

    genvalidity Data.GenValidity

    A class of types for which valid values can be generated to be valid.

    How to instantiate GenValid

    Step 1: Try to instantiate GenValid without overriding any functions. It is possible that, if few values are valid or if validity checking is expensive, the resulting generator is too slow. In that case, go to Step 2. Step 2: Consider using genValidStructurallyWithoutExtraChecking and shrinkValidStructurallyWithoutExtraFiltering to speed up generation. This only works if your type has a derived or trivial Validity instance. Step 3: If that still is not fast enough, consider writing your own generator and shrinking function. Make sure to generate any possible valid value, but only valid values.

    A note about Arbitrary

    If you also write Arbitrary instances for GenValid types, it may be best to simply use
    instance Arbitrary A where
    arbitrary = genValid
    shrink = shrinkValid
    

  10. gGenValid :: GGenValid f => Gen (f a)

    genvalidity Data.GenValidity

    No documentation available.

Page 423 of many | Previous | Next