summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-haskell/hscolour/files/hscolour-1.19-ghc-7.5.patch')
-rw-r--r--dev-haskell/hscolour/files/hscolour-1.19-ghc-7.5.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/dev-haskell/hscolour/files/hscolour-1.19-ghc-7.5.patch b/dev-haskell/hscolour/files/hscolour-1.19-ghc-7.5.patch
new file mode 100644
index 000000000000..25e29728ca3a
--- /dev/null
+++ b/dev-haskell/hscolour/files/hscolour-1.19-ghc-7.5.patch
@@ -0,0 +1,45 @@
+--- hscolour-1.19-orig/Language/Haskell/HsColour/Colourise.hs 2011-06-06 03:05:04.000000000 +1000
++++ hscolour-1.19/Language/Haskell/HsColour/Colourise.hs 2012-06-24 10:29:57.990963394 +1000
+@@ -1,3 +1,7 @@
++{-# LANGUAGE CPP #-}
++#if (__GLASGOW_HASKELL__>=705)
++{-# LANGUAGE ScopedTypeVariables #-}
++#endif
+ module Language.Haskell.HsColour.Colourise
+ ( module Language.Haskell.HsColour.ColourHighlight
+ , ColourPrefs(..)
+@@ -9,6 +13,9 @@
+ import Language.Haskell.HsColour.ColourHighlight
+ import Language.Haskell.HsColour.Classify (TokenType(..))
+
++#if (__GLASGOW_HASKELL__>=705)
++import Control.Exception (catch, SomeException)
++#endif
+ import System.IO (hPutStrLn,stderr)
+ import System.Environment (getEnv)
+ import Data.List
+@@ -51,6 +58,16 @@
+ -- | Read colour preferences from .hscolour file in the current directory, or failing that,
+ -- from \$HOME\/.hscolour, and failing that, returns a default set of prefs.
+ readColourPrefs :: IO ColourPrefs
++#if (__GLASGOW_HASKELL__>=705)
++readColourPrefs = catch
++ (do val <- readFile ".hscolour"
++ parseColourPrefs ".hscolour" val)
++ (\(_ :: SomeException) -> catch
++ (do home <- getEnv "HOME"
++ val <- readFile (home++"/.hscolour")
++ parseColourPrefs (home++"/.hscolour") val)
++ (\(_ :: SomeException) -> return defaultColourPrefs))
++#else
+ readColourPrefs = catch
+ (do val <- readFile ".hscolour"
+ parseColourPrefs ".hscolour" val)
+@@ -59,6 +76,7 @@
+ val <- readFile (home++"/.hscolour")
+ parseColourPrefs (home++"/.hscolour") val)
+ (\_-> return defaultColourPrefs))
++#endif
+
+ -- | Convert token classification to colour highlights.
+ colourise :: ColourPrefs -> TokenType -> [Highlight]