mutagen-0.1.0.0: Property-based testing framework for Haskell using type-preserving mutations.
Safe HaskellNone
LanguageHaskell2010

Test.Mutagen.Lazy

Description

Tracking lazy evaluation of expressions.

Synopsis

Lazy evaluation tracking interface

__evaluated__ :: Pos -> a -> a Source #

Injectable function to mark the evaluation an expression at some position.

Lazy type class

class Lazy a where Source #

Class for types that can track lazy evaluation of their subexpressions.

Minimal complete definition

lazyNode

Methods

lazy :: a -> a Source #

Wrap an entire value (i.e., at every subexpression) with calls to __evaluated__ with their corresponding positions.

This is a convenience function defined as:

lazy x  = lazyNode [] x

And you usually want to define lazyNode instead.

lazyNode :: Pos -> a -> a Source #

Wrap a value at a given position with calls to __evaluated__.

You can use withLazy to test which subexpressions are evaluated by a given function. For example:

>>> let a = Right (undefined, Just 42) :: Either Bool (String, Maybe Int)
>>> withLazy (\x -> case x of Right (_, Just _) -> True; _ -> False) a
([[],[0],[0,1]],True)

Which indicates that the function evaluated:

  • [] -> root node (Right)
  • [0] -> Right's 0th child (the tuple)
  • [0,1] -> the tuple's 1st child (Just)

While not evaluating neihter the undefined nor the 42.

Instances

Instances details
Lazy Word16 Source # 
Instance details

Defined in Test.Mutagen.Lazy

Lazy Word32 Source # 
Instance details

Defined in Test.Mutagen.Lazy

Lazy Word64 Source # 
Instance details

Defined in Test.Mutagen.Lazy

Lazy Word8 Source # 
Instance details

Defined in Test.Mutagen.Lazy

Lazy Args Source # 
Instance details

Defined in Test.Mutagen.Property

Methods

lazy :: Args -> Args Source #

lazyNode :: Pos -> Args -> Args Source #

Lazy () Source # 
Instance details

Defined in Test.Mutagen.Lazy

Methods

lazy :: () -> () Source #

lazyNode :: Pos -> () -> () Source #

Lazy Bool Source # 
Instance details

Defined in Test.Mutagen.Lazy

Methods

lazy :: Bool -> Bool Source #

lazyNode :: Pos -> Bool -> Bool Source #

Lazy Char Source # 
Instance details

Defined in Test.Mutagen.Lazy

Methods

lazy :: Char -> Char Source #

lazyNode :: Pos -> Char -> Char Source #

Lazy Double Source # 
Instance details

Defined in Test.Mutagen.Lazy

Lazy Float Source # 
Instance details

Defined in Test.Mutagen.Lazy

Lazy Int Source # 
Instance details

Defined in Test.Mutagen.Lazy

Methods

lazy :: Int -> Int Source #

lazyNode :: Pos -> Int -> Int Source #

Lazy a => Lazy (Maybe a) Source # 
Instance details

Defined in Test.Mutagen.Lazy

Methods

lazy :: Maybe a -> Maybe a Source #

lazyNode :: Pos -> Maybe a -> Maybe a Source #

Lazy a => Lazy [a] Source # 
Instance details

Defined in Test.Mutagen.Lazy

Methods

lazy :: [a] -> [a] Source #

lazyNode :: Pos -> [a] -> [a] Source #

Lazy v => Lazy (Map k v) Source # 
Instance details

Defined in Test.Mutagen.Lazy

Methods

lazy :: Map k v -> Map k v Source #

lazyNode :: Pos -> Map k v -> Map k v Source #

(Lazy a, Lazy b) => Lazy (Either a b) Source # 
Instance details

Defined in Test.Mutagen.Lazy

Methods

lazy :: Either a b -> Either a b Source #

lazyNode :: Pos -> Either a b -> Either a b Source #

(Lazy a, Lazy b) => Lazy (a, b) Source # 
Instance details

Defined in Test.Mutagen.Lazy

Methods

lazy :: (a, b) -> (a, b) Source #

lazyNode :: Pos -> (a, b) -> (a, b) Source #

(Lazy a, Lazy b, Lazy c) => Lazy (a, b, c) Source # 
Instance details

Defined in Test.Mutagen.Lazy

Methods

lazy :: (a, b, c) -> (a, b, c) Source #

lazyNode :: Pos -> (a, b, c) -> (a, b, c) Source #

(Lazy a, Lazy b, Lazy c, Lazy d) => Lazy (a, b, c, d) Source # 
Instance details

Defined in Test.Mutagen.Lazy

Methods

lazy :: (a, b, c, d) -> (a, b, c, d) Source #

lazyNode :: Pos -> (a, b, c, d) -> (a, b, c, d) Source #

(Lazy a, Lazy b, Lazy c, Lazy d, Lazy e) => Lazy (a, b, c, d, e) Source # 
Instance details

Defined in Test.Mutagen.Lazy

Methods

lazy :: (a, b, c, d, e) -> (a, b, c, d, e) Source #

lazyNode :: Pos -> (a, b, c, d, e) -> (a, b, c, d, e) Source #

(Lazy a, Lazy b, Lazy c, Lazy d, Lazy e, Lazy f) => Lazy (a, b, c, d, e, f) Source # 
Instance details

Defined in Test.Mutagen.Lazy

Methods

lazy :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) Source #

lazyNode :: Pos -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) Source #

(Lazy a, Lazy b, Lazy c, Lazy d, Lazy e, Lazy f, Lazy g) => Lazy (a, b, c, d, e, f, g) Source # 
Instance details

Defined in Test.Mutagen.Lazy

Methods

lazy :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) Source #

lazyNode :: Pos -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) Source #

(Lazy a, Lazy b, Lazy c, Lazy d, Lazy e, Lazy f, Lazy g, Lazy h) => Lazy (a, b, c, d, e, f, g, h) Source # 
Instance details

Defined in Test.Mutagen.Lazy

Methods

lazy :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) Source #

lazyNode :: Pos -> (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) Source #

(Lazy a, Lazy b, Lazy c, Lazy d, Lazy e, Lazy f, Lazy g, Lazy h, Lazy i) => Lazy (a, b, c, d, e, f, g, h, i) Source # 
Instance details

Defined in Test.Mutagen.Lazy

Methods

lazy :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) Source #

lazyNode :: Pos -> (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) Source #

(Lazy a, Lazy b, Lazy c, Lazy d, Lazy e, Lazy f, Lazy g, Lazy h, Lazy i, Lazy j) => Lazy (a, b, c, d, e, f, g, h, i, j) Source # 
Instance details

Defined in Test.Mutagen.Lazy

Methods

lazy :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) Source #

lazyNode :: Pos -> (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) Source #

withLazy :: Lazy a => (a -> b) -> a -> IO ([Pos], b) Source #

Find which subexpressions of an input value does a function evaluate when forcing its result to weak head normal form.

withLazyIO :: Lazy a => (a -> IO b) -> a -> IO ([Pos], b) Source #

Like withLazy, but for functions that already run on IO.