Ticket #2653 (closed merge: fixed)
Hugs does not like bracketOnError in Network.hs
Description
Currently network/Network.hs has this:
-- Utils
#if __GLASGOW_HASKELL__ < 606
-- Like bracket, but only performs the final action if there was an
-- exception raised by the middle bit.
bracketOnError
:: IO a -- ^ computation to run first (\"acquire resource\")
-> (a -> IO b) -- ^ computation to run last (\"release resource\")
-> (a -> IO c) -- ^ computation to run in-between
-> IO c -- returns the value from the in-between computation
bracketOnError before after thing =
Exception.block (do
a <- before
r <- Exception.catch
(Exception.unblock (thing a))
(\e -> do { after a; Exception.throw e })
return r
)
#else
bracketOnError = Exception.bracketOnError
#endif
So Hugs gets the <606 definition which it does not like (type error printed on bracketOnError).
runhugs: Error occurred ERROR "/home2/dima/install/hugs98/hugsdir/packages/network/Network.hs":511 - Cannot justify constraints in explicitly typed binding *** Expression : bracketOnError *** Type : IO a -> (a -> IO b) -> (a -> IO c) -> IO c *** Given context : () *** Constraints : Exception d
This can be fixed by adding && !__HUGS__ to the #if line.
That is (darcs whatsnew),
{
hunk ./Network.hs 378
-#if __GLASGOW_HASKELL__ < 606
+#if __GLASGOW_HASKELL__ < 606 && !__HUGS__
}
so Hugs gets the second definition (redirected to Exception.bracketOnError) which works.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

