[Haskell-cafe] Newbie and working with IO Int and Int

Víctor A. Rodríguez victor at bit-man.com.ar
Tue Oct 17 13:08:48 EDT 2006


Hi,

> What's wrong with doing it this way?
>
> -- ** UNTESTED CODE **
>
> verifyAdd :: Int -> Int -> Int -> Bool
> verifyAdd a b sum | a + b == sum = True
>                   otherwise    = False
>
> testAddMundane :: Int -> Int -> Bool
> testAddMundane a b = verifyAdd a b (a + b)
>
> -- all the IO-dependent stuff is below this line --
>
> testAddRandom :: IO Bool
> testAddRandom = do a <- randomIO
>                    b <- randomIO
>                    return verifyAdd a b (a + b)
>

First "thanks", but the problem is that I can't check if testAddRandom was
sucessfull or not. If I replace (a+b) with (a+b-1) it still executes but
couldn't check if it's True or False :-P
--
Víctor A. Rodríguez (http://www.bit-man.com.ar)
El bit Fantasma (Bit-Man)
Perl Mongers Capital Federal (http://cafe.pm.org/)
GNU/Linux User Group - FCEyN - UBA (http://glugcen.dc.uba.ar/)



More information about the Haskell-Cafe mailing list