[Haskell-cafe] Using quickcheck to check for errors
ky3 at atamo.com
Sat Jun 7 19:40:50 UTC 2014
On Sun, Jun 8, 2014 at 1:56 AM, Rafael Almeida <almeidaraf at gmail.com> wrote:
> Let's say we want to quickcheck the function !!. Passing a negative index
> to it is an error. However, how can you make a check that it indeed errors
> in such situation?
The problem is that (!!) is a partial function, like head. How would you
check that head  is an error?
What you could do is quickcheck a safe version of (!!) -- see Safe.atMay --
that returns a Maybefied type.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe