[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

haskell pastis



pastis builds with GHC 7.6 with the attached patch applied
Index: haskell-pastis-0.1.2/Network/Pastis.hs
===================================================================
--- haskell-pastis-0.1.2.orig/Network/Pastis.hs	2012-11-10 16:46:28.384282442 +0000
+++ haskell-pastis-0.1.2/Network/Pastis.hs	2012-11-10 16:47:06.364275833 +0000
@@ -1,11 +1,14 @@
+{-# LANGUAGE ScopedTypeVariables #-}
+
 module Network.Pastis (pastisURL) where
 
+import Control.Exception.Base (catch, IOException)
 import Network.HTTP
 import Network.URI
 
 -- | Use pastisURL to shorten a URL. If an error occurs, the function returns 'url'.
 pastisURL :: String -> IO String
-pastisURL url = fmap (either (const url) rspBody) (simpleHTTP request) `catch` (return . const url)
+pastisURL url = fmap (either (const url) rspBody) (simpleHTTP request) `catch` (\(_ :: IOException) -> return url)
   where request = Request { rqURI = uri
                           , rqMethod = GET
                           , rqHeaders = []
@@ -14,4 +17,4 @@
                   , uriAuthority = Just $ URIAuth { uriUserInfo = "", uriRegName = "past.is", uriPort = "" }
                   , uriPath = "/api/"
                   , uriQuery = "?format=simple&url=" ++ escapeURIString isUnreserved url
-                  , uriFragment = "" }
\ No newline at end of file
+                  , uriFragment = "" }

Reply to: