haskell TinyURL
TinyURL builds with GHC 7.6 with the attached patch.
Index: haskell-tinyurl-0.1.0/Network/TinyURL.hs
===================================================================
--- haskell-tinyurl-0.1.0.orig/Network/TinyURL.hs 2009-02-16 19:19:31.000000000 +0000
+++ haskell-tinyurl-0.1.0/Network/TinyURL.hs 2012-11-10 17:09:05.063668586 +0000
@@ -1,5 +1,8 @@
+{-# LANGUAGE ScopedTypeVariables #-}
+
module Network.TinyURL (tinyURL) where
+import Control.Exception.Base (catch, IOException)
import Network.HTTP
import Network.URI
@@ -7,7 +10,7 @@
-- the original URL.
tinyURL :: String -> IO String
tinyURL url = do
- result <- simpleHTTP request `catch` (const . return $ Left undefined)
+ result <- simpleHTTP request `catch` (\(_ :: IOException) -> return $ Left undefined)
case result of
Left _ -> return url
Right response -> return $ rspBody response
Reply to: