Browse files

remove use of Either types as per suggestion in #4

  • Loading branch information...
1 parent 221f311 commit 82d777fe1a209aa873e5a3155109475258519ae4 @dcolish committed Oct 27, 2011
Showing with 5 additions and 7 deletions.
  1. +4 −4 Network/Imgurder.hs
  2. +1 −3 main.hs
View
8 Network/Imgurder.hs
@@ -105,7 +105,7 @@ curlMultiPost' s os ps = do
getResponseCode h
-upload :: String -> FilePath -> IO (Either ImgurUpload ImgurUpload)
+upload :: String -> FilePath -> IO (ImgurUpload)
upload key file = withCurlDo $ do
ref <- newIORef []
resp <- curlMultiPost' "http://api.imgur.com/1/upload.xml"
@@ -116,8 +116,8 @@ upload key file = withCurlDo $ do
response <- fmap reverse $ readIORef ref
let imgurUpload = imgurify . formattedResult . result $ response
case imgurUpload of
- Just a -> return . Right $ a
- Nothing -> return . Left $ ImgurFailure (-1)
- _ -> return . Left $ ImgurFailure resp
+ Just a -> return $ a
+ Nothing -> return $ ImgurFailure (-1)
+ _ -> return $ ImgurFailure resp
where
result = head . H.xread . concatMap (unwords.tail.lines)
View
4 main.hs
@@ -10,6 +10,4 @@ main :: IO ()
main = do
[file] <- getArgs
imgurUpload <- upload key file
- case imgurUpload of
- Right a -> print a
- Left a -> print a -- Uknown Error happened
+ print imgurUpload

0 comments on commit 82d777f

Please sign in to comment.