[Haskell-beginners] HUnit - testing for failed pattern match
Xavier Shay
xavier-list at rhnh.net
Wed Feb 23 02:25:28 CET 2011
On 23/02/11 10:35 AM, Edward Z. Yang wrote:
> What you describe is one of the cases when a partial function is ok
> (though it's probably better to do something like:
>
> giveMeThree x
> | x == 3 = True
> | otherwise = error "giveMeThree: not three"
>
> It's frequently not possible, but if you can arrange your types so that
> the invalid values are not possible, even better.)
ah that's good, I can give a helpful error message.
Still would like a way to test it though...
More information about the Beginners
mailing list