[Haskell-beginners] Help with TAP implemation in haskell

Felipe Lessa felipe.lessa at gmail.com
Tue Feb 24 21:38:42 EST 2009


On Tue, Feb 24, 2009 at 10:32 PM, Patrick LeBoutillier
<patrick.leboutillier at gmail.com> wrote:
> _cleanup :: Int -> TAP Int
> _cleanup rc = do
>    ts <- get
>    if (not $ planSet ts)
>        then do
>            diag "Looks like your test died before it could output anything."
>            return rc
>        else if (testDied ts)
>            then do
>                diag $ "Looks like your test died just after " ++
> (show $ executedTests ts)
>                return rc
>            else ...

_cleanup rc = do
  ts <- get
  let err | not (planSet ts) = diag "Looks like...anything."
          | testDied ts      = diag $ "Looks like...after " ++ show
(executedTests ts)
          | otherwise        = return () -- assuming diag :: String -> TAP ()
  err >> return rc

or maybe

_cleanup rc = get >>= showErrs >> return rc
    where
      showErrs ts
          | not (planSet ts) = diag "Looks like...anything."
          | testDied ts      = diag $ "Looks like...after " ++ show
(executedTests ts)
          | otherwise        = return ()

HTH,

-- 
Felipe.


More information about the Beginners mailing list