Browse files

Fixed to compile with GHC 6.12.

System.IO.UTF8 is imported conditionally for earlier versions.
  • Loading branch information...
1 parent b32fe9f commit 2c8eee0d5246304b4bcb97b22f404a5797acc324 @jgm committed Jan 1, 2010
Showing with 34 additions and 4 deletions.
  1. +7 −1 Yst/Build.hs
  2. +5 −0 Yst/CSV.hs
  3. +6 −1 Yst/Render.hs
  4. +6 −0 Yst/Util.hs
  5. +3 −1 yst.cabal
  6. +7 −1 yst.hs
View
8 Yst/Build.hs
@@ -28,9 +28,15 @@ import System.FilePath
import System.Directory
import System.Exit
import System.Time (ClockTime(..))
+-- Note: ghc >= 6.12 (base >=4.2) supports unicode through iconv
+-- So we use System.IO.UTF8 only if we have an earlier version
+#if MIN_VERSION_base(4,2,0)
+import System.IO (hPutStrLn)
+#else
+import Prelude hiding (readFile, putStrLn, print, writeFile)
import System.IO.UTF8
+#endif
import System.IO (stderr)
-import Prelude hiding (readFile, putStrLn, print, writeFile)
import Control.Monad
dependencies :: Site -> String -> [FilePath]
View
5 Yst/CSV.hs
@@ -21,8 +21,13 @@ where
import Yst.Types
import Yst.Util
import Text.CSV
+-- Note: ghc >= 6.12 (base >=4.2) supports unicode through iconv
+-- So we use System.IO.UTF8 only if we have an earlier version
+#if MIN_VERSION_base(4,2,0)
+#else
import Prelude hiding (readFile)
import System.IO.UTF8
+#endif
readCSVFile :: FilePath -> IO Node
readCSVFile f = catch (readFile f >>= return . csvToNode . parseCSV' f . stripBlanks)
View
7 Yst/Render.hs
@@ -30,8 +30,13 @@ import Data.List.Split (wordsBy)
import Text.StringTemplate
import Data.Maybe (fromMaybe)
import System.FilePath
-import System.IO.UTF8
+-- Note: ghc >= 6.12 (base >=4.2) supports unicode through iconv
+-- So we use System.IO.UTF8 only if we have an earlier version
+#if MIN_VERSION_base(4,2,0)
+#else
import Prelude hiding (readFile, putStrLn, print, writeFile)
+import System.IO.UTF8
+#endif
import Data.Time
import Control.Monad
View
6 Yst/Util.hs
@@ -22,7 +22,13 @@ import Yst.Types
import System.Exit
import System.FilePath
import System.IO (stderr)
+-- Note: ghc >= 6.12 (base >=4.2) supports unicode through iconv
+-- So we use System.IO.UTF8 only if we have an earlier version
+#if MIN_VERSION_base(4,2,0)
+import System.IO (hPutStrLn)
+#else
import System.IO.UTF8 (hPutStrLn)
+#endif
import System.Directory
import Control.Monad
import Data.Time
View
4 yst.cabal
@@ -1,5 +1,6 @@
name: yst
-version: 0.2.2
+version: 0.2.2.1
+Tested-With: GHC == 6.10.4, GHC == 6.12.1
Cabal-version: >= 1.2
build-type: Simple
synopsis: Builds a static website from templates and data in YAML or
@@ -50,5 +51,6 @@ Executable yst
filepath, containers, directory, utf8-string, time,
old-locale, old-time, parsec, xhtml, pandoc, bytestring,
split
+ extensions: CPP
ghc-options: -Wall -threaded -fno-warn-orphans
ghc-prof-options: -auto-all -caf-all
View
8 yst.hs
@@ -26,9 +26,15 @@ import System.FilePath
import System.Environment
import System.Directory
import System.Exit
+-- Note: ghc >= 6.12 (base >=4.2) supports unicode through iconv
+-- So we use System.IO.UTF8 only if we have an earlier version
+#if MIN_VERSION_base(4,2,0)
+import System.IO (hPutStrLn)
+#else
+import Prelude hiding (readFile, putStrLn, print, writeFile)
import System.IO.UTF8
+#endif
import System.IO (stderr)
-import Prelude hiding (readFile, putStrLn, print, writeFile)
import Control.Monad
createSite :: FilePath -> IO ()

0 comments on commit 2c8eee0

Please sign in to comment.