diff --git a/src/Yi/Rope.hs b/src/Yi/Rope.hs
--- a/src/Yi/Rope.hs
+++ b/src/Yi/Rope.hs
@@ -1,4 +1,5 @@
 {-# LANGUAGE BangPatterns #-}
+{-# LANGUAGE CPP #-}
 {-# LANGUAGE DeriveDataTypeable #-}
 {-# LANGUAGE MultiParamTypeClasses #-}
 {-# OPTIONS_HADDOCK show-extensions #-}
@@ -59,7 +60,9 @@
 
   ) where
 
+#if __GLASGOW_HASKELL__ > 706
 import           Codec.Text.Detect (detectEncodingName)
+#endif
 import           Control.Applicative ((<$>))
 import           Control.DeepSeq
 import           Data.Binary
@@ -74,6 +77,9 @@
 import           Data.Monoid
 import           Data.String (IsString(..))
 import qualified Data.Text as TX
+#if __GLASGOW_HASKELL__ < 708
+import qualified Data.Text.Encoding as TE
+#endif
 import           Data.Text.ICU.Convert
 import qualified Data.Text.IO as TF (writeFile)
 import           Data.Typeable
@@ -698,6 +704,7 @@
 -- character decoding.
 readFile :: FilePath -> IO (Either TX.Text (YiString, ConverterName))
 readFile fp = do
+#if __GLASGOW_HASKELL__ > 706
   cs <- BSL.readFile fp
   case detectEncodingName cs of
    Nothing -> return . Left . TX.pack $ "Could not guess the encoding of " <> fp
@@ -714,6 +721,12 @@
         c <- open s (Just True)
         let st = BSL.toStrict cs
         return $ Right (fromText . toUnicode c $ st, CN $ getName c)
+#else
+  cs <- BS.readFile fp
+  case TE.decodeUtf8' cs of
+    Left e -> return . Left . TX.pack $ show e
+    Right t -> return $ Right (fromText t, CN "UTF-8")
+#endif
 
 -- | Filters the characters from the underlying string.
 --
diff --git a/yi-rope.cabal b/yi-rope.cabal
--- a/yi-rope.cabal
+++ b/yi-rope.cabal
@@ -1,5 +1,5 @@
 name:                yi-rope
-version:             0.5.0.1
+version:             0.5.1.0
 synopsis:            A rope data structure used by Yi
 description:         A rope data structure used by Yi
 license:             GPL-2
@@ -23,12 +23,14 @@
       base >=4.5 && <5
     , binary
     , bytestring
-    , charsetdetect-ae
     , data-default
     , deepseq
     , fingertree
     , text
     , text-icu
+
+  if impl(ghc < 7.8)
+    build-depends: charsetdetect-ae
 
   hs-source-dirs:      src
   default-language:    Haskell2010
