Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Update app/App.hs #18

Open
wants to merge 1 commit into from

1 participant

@Peaker

Use list comprehension with guards

@Peaker Peaker Update app/App.hs
Use list comprehension with guards
01131c4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 29, 2013
  1. @Peaker

    Update app/App.hs

    Peaker authored
    Use list comprehension with guards
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 9 deletions.
  1. +7 −9 app/App.hs
View
16 app/App.hs
@@ -146,17 +146,15 @@ maybeWriteFile _ _ = return ()
validateArgs :: Args -> IO ()
validateArgs Args{..} = do
- let p !? what | p = Nothing
- | otherwise = Just $ "Argument to " ++ what
- infix 1 !?
- problems = catMaybes [
- concurrency > 0 !? "--concurrency must be positive"
- , num_requests > 0 !? "--num-requests must be positive"
- , requests_per_second >= 0 !? "--requests-per-second cannot be negative"
- , timeout >= 0 !? "--timeout cannot be negative"
- ]
forM_ problems $ hPutStrLn stderr . ("Error: " ++)
unless (null problems) $ exitWith (ExitFailure 1)
+ where
+ problems = concat
+ [ [ "--concurrency must be positive" | concurrency <= 0 ]
+ , [ "--num-requests must be positive" | num_requests <= 0 ]
+ , [ "--requests-per-second cannot be negative" | requests_per_second < 0 ]
+ , [ "--timeout cannot be negative" | timeout < 0 ]
+ ]
createRequest :: Args -> IO (E.Request (ResourceT IO))
createRequest Args{..} = do
Something went wrong with that request. Please try again.