[Pkg-haskell-commits] darcs: haskell-hgl: Actually push patches

Ernesto Hernández-Novich (USB) emhn at usb.ve
Sat Aug 24 03:00:21 UTC 2013


Sat Aug 24 02:59:53 UTC 2013  Ernesto Hern[_<U+00E1>_]ndez-Novich (USB) <emhn at usb.ve>
  * Actually push patches

    A ./patches/00-cabal-rules.patch
    A ./patches/01-new-exceptions.patch
    A ./patches/02-exceptions.patch
    A ./patches/03-channel.patch
    A ./patches/series

Sat Aug 24 02:59:53 UTC 2013  Ernesto Hernández-Novich (USB) <emhn at usb.ve>
  * Actually push patches
diff -rN -u old-haskell-hgl/patches/00-cabal-rules.patch new-haskell-hgl/patches/00-cabal-rules.patch
--- old-haskell-hgl/patches/00-cabal-rules.patch	1970-01-01 00:00:00.000000000 +0000
+++ new-haskell-hgl/patches/00-cabal-rules.patch	2013-08-24 03:00:20.861543730 +0000
@@ -0,0 +1,16 @@
+Description: Change cabal file to include proper dependencies for
+ building with GHC 7.4.
+Forwarded: yes
+Author: Ernesto Hernández-Novich (USB) <emhn at usb.ve>
+
+--- a/HGL.cabal
++++ b/HGL.cabal
+@@ -22,7 +22,7 @@
+ 
+ library
+   if flag(split-base)
+-    build-depends: base >= 3 && < 4, array
++    build-depends: base >= 3, array, stm
+   else
+     build-depends: base < 2
+   exposed-modules:
diff -rN -u old-haskell-hgl/patches/01-new-exceptions.patch new-haskell-hgl/patches/01-new-exceptions.patch
--- old-haskell-hgl/patches/01-new-exceptions.patch	1970-01-01 00:00:00.000000000 +0000
+++ new-haskell-hgl/patches/01-new-exceptions.patch	2013-08-24 03:00:20.865540947 +0000
@@ -0,0 +1,33 @@
+Description: Convert old-style try/catch to new-style Control.Exception
+ style. This gets rids of several compilation warnings. I left this
+ patch separate because I removed an #ifdef and am not sure if this is
+ the best way to solve the issue.
+Forwarded: yes
+Author: Ernesto Hernández-Novich <emhn at usb.ve>
+
+--- a/Graphics/HGL/Internals/Utilities.hs
++++ b/Graphics/HGL/Internals/Utilities.hs
+@@ -20,7 +20,7 @@
+         modMVar, modMVar_
+ 	) where
+ 
+-import qualified Control.Exception as E (bracket, try, IOException, tryJust, ioErrors)
++import qualified Control.Exception as E (bracket, try, IOException, tryJust)
+ import Control.Concurrent( MVar, takeMVar, putMVar )
+ 
+ bracket :: IO a -> (a -> IO b) -> (a -> IO c) -> IO c
+@@ -32,14 +32,7 @@
+ 
+ type Exception = E.IOException
+ safeTry :: IO a -> IO (Either Exception a)
+-
+-#if __GLASGOW_HASKELL >= 610 
+--- ghc-6.10
+ safeTry = E.try
+-#else
+--- ghc 6.8 (and below?)
+-safeTry = E.tryJust E.ioErrors
+-#endif
+ 
+ 
+ ----------------------------------------------------------------
diff -rN -u old-haskell-hgl/patches/02-exceptions.patch new-haskell-hgl/patches/02-exceptions.patch
--- old-haskell-hgl/patches/02-exceptions.patch	1970-01-01 00:00:00.000000000 +0000
+++ new-haskell-hgl/patches/02-exceptions.patch	2013-08-24 03:00:20.865540947 +0000
@@ -0,0 +1,65 @@
+Description: Convert old-style try/catch to new-style Control.Exception
+ style. This gets rids of several compilation warnings.
+Forwarded: yes
+Author: Ernesto Hernández-Novich <emhn at usb.ve>
+
+--- a/Graphics/HGL/X11/Display.hs
++++ b/Graphics/HGL/X11/Display.hs
+@@ -1,3 +1,5 @@
++{-# LANGUAGE ScopedTypeVariables #-}
++
+ -- #hide
+ module Graphics.HGL.X11.Display
+ 	( getDisplayName
+@@ -14,12 +16,13 @@
+ import Control.Monad (when)
+ import Data.Maybe (isJust)
+ import System.Environment (getEnv)
+-import System.IO.Error (try)
+ import System.IO.Unsafe (unsafePerformIO)
+ 
++import qualified Control.Exception as CE
++
+ getDisplayName :: IO String
+ getDisplayName = do
+-  disp <- try (getEnv "DISPLAY")
++  disp <- CE.try (getEnv "DISPLAY") :: IO (Either CE.IOException String)
+   return (either (const ":0.0") id disp)
+ 
+ displayRef :: MVar (Maybe X.Display)
+@@ -32,8 +35,9 @@
+   openDisplay'
+  where
+   openDisplay' = do      
+-    display <- X.openDisplay host `catch` \ err -> 
+-                 ioError (userError ("Unable to open X display " ++ host))
++    display <- X.openDisplay host
++               `CE.catch`
++               (\(e :: CE.SomeException) -> ioError $ userError $ "Unable to open X display " ++ host)
+     modMVar displayRef (const $ Just display)
+     return display
+ 
+--- a/Graphics/HGL/X11/Types.hs
++++ b/Graphics/HGL/X11/Types.hs
+@@ -1,3 +1,4 @@
++{-# LANGUAGE ScopedTypeVariables #-}
+ -----------------------------------------------------------------------------
+ -- |
+ -- Module      :  Graphics.HGL.X11.Types
+@@ -26,6 +27,7 @@
+ import Graphics.HGL.Internals.Types
+ 
+ import qualified Graphics.X11.Xlib as X
++import qualified Control.Exception as CE
+ 
+ import Control.Concurrent.MVar (MVar)
+ import Data.Bits
+@@ -84,7 +86,7 @@
+   (X.Color p _ _ _ _) <-
+       X.allocColor display color_map (X.Color 0 r g b xcolor_flags)
+   return p)
+-     `catch` \ err -> 
++     `CE.catch` \(err :: CE.SomeException) ->
+                print err >> return 0
+ --	       ioError (userError ("Error: " ++ show err
+ --			      ++ "\nUnable to allocate colo[u]r " ++ show (r,g,b) 
diff -rN -u old-haskell-hgl/patches/03-channel.patch new-haskell-hgl/patches/03-channel.patch
--- old-haskell-hgl/patches/03-channel.patch	1970-01-01 00:00:00.000000000 +0000
+++ new-haskell-hgl/patches/03-channel.patch	2013-08-24 03:00:20.865540947 +0000
@@ -0,0 +1,46 @@
+Description: Stop using Control.Concurrent.Chan and migrate to the
+ more modern Control.Concurrent.STM.TChan. Migration was triggered
+ by the fact that the library needs isEmptyChan and GHC 7.4 suggest
+ using STM's version instead.
+Forwarded: yes
+Author: Ernesto Hernández-Novich (USB) <emhn at usb.ve>
+
+--- a/Graphics/HGL/Internals/Events.hs
++++ b/Graphics/HGL/Internals/Events.hs
+@@ -20,7 +20,8 @@
+ 
+ import Graphics.HGL.Internals.Event
+ import Graphics.HGL.Internals.Flag
+-import Control.Concurrent.Chan(Chan, newChan, readChan, writeChan, isEmptyChan)
++import Control.Concurrent.STM (atomically)
++import Control.Concurrent.STM.TChan (TChan, newTChan, readTChan, writeTChan, isEmptyTChan)
+ 
+ ----------------------------------------------------------------
+ -- Interface
+@@ -37,7 +38,7 @@
+ -- of the Graphics library).  Exposure events in X11 behave in a
+ -- similar way except that they do not overtake other events.)
+ 
+-data Events = Events { events :: Chan Event
++data Events = Events { events :: TChan Event
+                      , tick   :: Flag ()
+                      }
+ 
+@@ -53,13 +54,13 @@
+ ----------------------------------------------------------------
+ 
+ newEvents = do
+-  events <- newChan 
++  events <- atomically $ newTChan
+   tick   <- newFlag
+   return (Events { events=events, tick=tick })
+ 
+-getEvent  evs = readChan    (events evs)
+-isNoEvent evs = isEmptyChan (events evs)
+-sendEvent evs = writeChan   (events evs)
++getEvent  evs = atomically $ readTChan    (events evs)
++isNoEvent evs = atomically $ isEmptyTChan (events evs)
++sendEvent evs = atomically . writeTChan   (events evs)
+ sendTick  evs = setFlag     (tick evs) ()
+ getTick   evs = resetFlag   (tick evs)
+ 
diff -rN -u old-haskell-hgl/patches/series new-haskell-hgl/patches/series
--- old-haskell-hgl/patches/series	1970-01-01 00:00:00.000000000 +0000
+++ new-haskell-hgl/patches/series	2013-08-24 03:00:20.865540947 +0000
@@ -0,0 +1,4 @@
+00-cabal-rules.patch
+01-new-exceptions.patch
+02-exceptions.patch
+03-channel.patch




More information about the Pkg-haskell-commits mailing list