Quickcheck specification DSL

113 views Asked by At

I want to create a human readable DSL which non-haskell programmer could understand for creating specifications for black-box testing of external systems.

And I wonder if something like this is possible to do in Haskell.

action = readProcess "sleep 1; print success"

prop_action = monadicIO $
    within 100000 >>=
    repliesWith (== "success")

within :: Int -> IO a -> IO
within t = fromMaybe False $ timeout t

repliesWith :: (a -> Bool) -> IO a -> IO Bool
repliesWith v = liftM v

Here I'm giving a pseudo code for checking that action would return value "success" within 0.1 seconds. It seems like I need some kind of monad that would short-circuit on false values to chain multiple checks that pass values from one to another.

Feel like something like this should exist. Maybe you can suggest a library or how to implement my idea in Haskell.

0

There are 0 answers