diff --git a/Debian/Apt/Dependencies.hs b/Debian/Apt/Dependencies.hs
--- a/Debian/Apt/Dependencies.hs
+++ b/Debian/Apt/Dependencies.hs
@@ -3,7 +3,7 @@
 module Debian.Apt.Dependencies
 {-
     ( solve
-    , State 
+    , State
     , binaryDepends
     , search
     , bj'
@@ -27,7 +27,7 @@
 
 -- * Basic CSP Types and Functions
 
-data Status 
+data Status
     = Remaining AndRelation
     | MissingDep Relation
     | Complete
@@ -87,13 +87,13 @@
     let preDepends =
             case lookupP "Pre-Depends" p of
               Nothing -> []
-              Just (Field (_,pd)) -> 
+              Just (Field (_,pd)) ->
                   either (error . show) id (parseRelations pd)
               Just (Comment _) -> error "depF"
         depends =
             case lookupP "Depends" p of
               Nothing -> []
-              Just (Field (_,pd)) -> 
+              Just (Field (_,pd)) ->
                   either (error . show) id (parseRelations pd)
               Just (Comment _) -> error "depF"
     in
@@ -207,7 +207,7 @@
 -- |earliestInconsistency does what it sounds like
 -- the 'reverse as' is because the vars are order high to low, but we
 -- want to find the lowest numbered (aka, eariest) inconsistency ??
--- 
+--
 earliestInconsistency :: CSP a -> State a -> Maybe ((BinPkgName, DebianVersion), (BinPkgName, DebianVersion))
 earliestInconsistency _ (_,[]) = Nothing
 earliestInconsistency _ (_,[_p]) = Nothing
@@ -262,7 +262,7 @@
             | isConflict cs  = mkTree (s, cs) ts
 --            | isConflict cs' = mkTree (s, cs') [] -- prevent space leak
             | otherwise = mkTree (s, cs') ts
-            where cs' = 
+            where cs' =
                       let set = combine csp (map label ts) [] in
                       set `seq` set -- prevent space leak
 
@@ -275,7 +275,7 @@
     | (not (lastvar `elem` c)) && null m = cs
     | null c && null m = ([],[]) -- is this case ever used?
     | otherwise = combine csp ns ((c, m):acc)
-    where lastvar = 
+    where lastvar =
               let (_,(p:_)) = s in (packageVersion csp) p
 
 
diff --git a/Debian/Apt/Index.hs b/Debian/Apt/Index.hs
--- a/Debian/Apt/Index.hs
+++ b/Debian/Apt/Index.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, ScopedTypeVariables #-}
+{-# LANGUAGE DeriveDataTypeable, FlexibleContexts, OverloadedStrings, ScopedTypeVariables #-}
 {-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-orphans #-}
 module Debian.Apt.Index
     ( update
@@ -52,7 +52,7 @@
     = BZ2 | GZ | Uncompressed
       deriving (Read, Show, Eq, Ord, Enum, Bounded)
 
-data CheckSums 
+data CheckSums
     = CheckSums { md5sum :: Maybe String
                 , sha1   :: Maybe String
                 , sha256 :: Maybe String
@@ -66,10 +66,10 @@
 -- A good choice might be a partially parameterized call to
 -- 'Debian.Apt.Methods.fetch'
 type Fetcher =
-    URI ->		-- remote URI
-    FilePath ->		-- local file name
-    Maybe UTCTime ->	-- optional time stamp for local file
-    IO Bool		-- True on success, False on failure
+    URI ->              -- remote URI
+    FilePath ->         -- local file name
+    Maybe UTCTime ->    -- optional time stamp for local file
+    IO Bool             -- True on success, False on failure
 
 -- |update - similar to apt-get update
 
@@ -78,12 +78,12 @@
 -- in \/var\/lib\/apt\/lists. You can almost use this function instead of
 -- calling apt-get update. However there are a few key differences:
 --  1. apt-get update also updates the binary cache files
---  2. apt-get update uses the partial directory and lock file in\ /var\/lib\/apt\/lists 
+--  2. apt-get update uses the partial directory and lock file in\ /var\/lib\/apt\/lists
 --  3. apt-get update downloads the Release and Release.gpg files
 update :: Fetcher -- ^ function that will do actually downloading
        -> FilePath -- ^ download indexes to the directory (must already exist)
        -> String -- ^ binary architecture
-       -> [DebSource] -- ^ sources.list 
+       -> [DebSource] -- ^ sources.list
        -> IO [Maybe (FilePath, Compression)] -- ^ (basename of index file, compression status)
 update fetcher basePath arch sourcesList =
     mapM (uncurry $ fetchIndex fetcher) (map (\(uri, fp, _) -> (uri, (basePath </> fp))) (concatMap (indexURIs arch) sourcesList))
@@ -126,7 +126,7 @@
       (release, sections) =
           either (error $ "indexURIs: support not implemented for exact path: " ++ render (pPrint debSource)) id (sourceDist debSource)
 
--- |return a tuple for the section 
+-- |return a tuple for the section
 --  - the URI to the uncompressed index file
 --  - the basename that apt-get uses for the downloaded index
 -- FIXME: support for Release and Release.gpg
@@ -204,7 +204,7 @@
       combine = (\x y -> sortBy (compare `on` snd) (x ++ y))
 {-
       with t@(_,_,fp) m =
-          let (un, compression) = 
+          let (un, compression) =
           in
             M.insertWith
 -}
@@ -238,7 +238,7 @@
       do indexes' <- mapM (filterExists distDir) (filter (isType iType) indexes)
          return $ map (head . snd) (filter (not . List.null . snd) indexes')
     where
-      isType iType (fp, _) = iType `isSuffixOf` fp 
+      isType iType (fp, _) = iType `isSuffixOf` fp
 
 {-
 findIndexes' :: FilePath -> String -> [FileTuple] -> IO [(FileTuple, Compression)]
@@ -268,7 +268,7 @@
 
 indexesInRelease :: (FilePath -> Bool)
                  -> Control' Text -- ^ A release file
-                 -> [(CheckSums, Integer, FilePath)] -- ^ 
+                 -> [(CheckSums, Integer, FilePath)] -- ^
 indexesInRelease filterp (Control [p]) =
     let md5sums =
             case md5sumField p of
diff --git a/Debian/Apt/Methods.hs b/Debian/Apt/Methods.hs
--- a/Debian/Apt/Methods.hs
+++ b/Debian/Apt/Methods.hs
@@ -138,13 +138,13 @@
                         | a == "Pipeline"        = c { pipeline = parseTrueFalse v }
                         | a == "Send-Config"     = c { sendConfig = parseTrueFalse v }
                         | a == "Needs-Cleanup"   = c { needsCleanup = parseTrueFalse v }
-                        | a == "Local-Only"	 = c { localOnly = parseTrueFalse v }
+                        | a == "Local-Only"      = c { localOnly = parseTrueFalse v }
                         | otherwise = error $ "unknown capability: " ++ show (a,v)
                     defaultCapabilities =
                         Capabilities { version = ""
                                      , singleInstance = False
-                                     , preScan 	      = False
-                                     , pipeline	      = False
+                                     , preScan        = False
+                                     , pipeline       = False
                                      , sendConfig     = False
                                      , needsCleanup   = False
                                      , localOnly      = False
diff --git a/Debian/Changes.hs b/Debian/Changes.hs
--- a/Debian/Changes.hs
+++ b/Debian/Changes.hs
@@ -31,14 +31,14 @@
 -- |A file generated by dpkg-buildpackage describing the result of a
 -- package build
 data ChangesFile =
-    Changes { changeDir :: FilePath		-- ^ The full pathname of the directory holding the .changes file.
-            , changePackage :: String		-- ^ The package name parsed from the .changes file name
-            , changeVersion :: DebianVersion	-- ^ The version number parsed from the .changes file name
-            , changeRelease :: ReleaseName	-- ^ The Distribution field of the .changes file
-            , changeArch :: Arch		-- ^ The architecture parsed from the .changes file name
-            , changeInfo :: S.Paragraph' Text	-- ^ The contents of the .changes file
-            , changeEntry :: ChangeLogEntry	-- ^ The value of the Changes field of the .changes file
-            , changeFiles :: [ChangedFileSpec]	-- ^ The parsed value of the Files attribute
+    Changes { changeDir :: FilePath             -- ^ The full pathname of the directory holding the .changes file.
+            , changePackage :: String           -- ^ The package name parsed from the .changes file name
+            , changeVersion :: DebianVersion    -- ^ The version number parsed from the .changes file name
+            , changeRelease :: ReleaseName      -- ^ The Distribution field of the .changes file
+            , changeArch :: Arch                -- ^ The architecture parsed from the .changes file name
+            , changeInfo :: S.Paragraph' Text   -- ^ The contents of the .changes file
+            , changeEntry :: ChangeLogEntry     -- ^ The value of the Changes field of the .changes file
+            , changeFiles :: [ChangedFileSpec]  -- ^ The parsed value of the Files attribute
             } deriving (Eq, Read, Show)
 
 -- |An entry in the list of files generated by the build.
@@ -162,7 +162,7 @@
 must be preceded by exactly one space. The maintainer details and the
 date must be separated by exactly two spaces.
 
-The entire changelog must be encoded in UTF-8. 
+The entire changelog must be encoded in UTF-8.
 -}
 
 -- | Parse the entries of a debian changelog and verify they are all
@@ -190,11 +190,11 @@
           case matchRegexAll entryRE text of
             Nothing -> Failure ["Parse error in changelog:\n" ++ show text]
             Just ("", _, remaining, [_, name, version, dists, urgency, _, details, _, _, _, _, _, who, date, _]) ->
-                Success (Entry name 
+                Success (Entry name
                                (parseDebianVersion version)
                                (map parseReleaseName . words $ dists)
                                urgency
-			       details
+                               details
                                who
                                date,
                          remaining)
@@ -208,11 +208,11 @@
     case text =~ entryRE :: MatchResult String of
       x | mrSubList x == [] -> Left ["Parse error in " ++ show text]
       MR {mrAfter = after, mrSubList = [_, name, ver, dists, urgency, _, details, _, _, who, _, date, _]} ->
-          Right (Entry name 
+          Right (Entry name
                          (parseDebianVersion ver)
                          (map parseReleaseName . words $ dists)
                          urgency
-			 ("  " ++ unpack (strip (pack details)) ++ "\n")
+                         ("  " ++ unpack (strip (pack details)) ++ "\n")
                          (take (length who - 2) who)
                          date,
                    after)
@@ -254,7 +254,7 @@
                        (parseDebianVersion ver)
                        (map parseReleaseName . words $ dists)
                        urgency
-		       details
+                       details
                        "" ""
       MR {mrSubList = x} -> error $ "Unexpected match: " ++ show x
     where
diff --git a/Debian/Control.hs b/Debian/Control.hs
--- a/Debian/Control.hs
+++ b/Debian/Control.hs
@@ -1,6 +1,6 @@
 {-# LANGUAGE OverloadedStrings #-}
 -- |A module for working with Debian control files <http://www.debian.org/doc/debian-policy/ch-controlfields.html>
-module Debian.Control 
+module Debian.Control
     ( -- * Types
       Control'(..)
     , Paragraph'(..)
diff --git a/Debian/Control/ByteString.hs b/Debian/Control/ByteString.hs
--- a/Debian/Control/ByteString.hs
+++ b/Debian/Control/ByteString.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE FlexibleContexts, MultiParamTypeClasses, PackageImports, ScopedTypeVariables #-}
+{-# LANGUAGE CPP, FlexibleContexts, MultiParamTypeClasses, PackageImports, ScopedTypeVariables #-}
 {-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-orphans #-}
 module Debian.Control.ByteString
     ( Control'(..)
@@ -21,6 +21,10 @@
 
 -- Standard GHC modules
 
+#if !MIN_VERSION_base(4,8,0)
+import Control.Applicative (Applicative(..))
+#endif
+import Control.Applicative (Alternative(..))
 import qualified Control.Exception as E
 import "mtl" Control.Monad.State
 
@@ -89,13 +93,13 @@
        else Ok (Comment text, bs')
 
 pParagraph :: ControlParser Paragraph
-pParagraph = 
+pParagraph =
     do f <- pMany1 (pComment <|> pField)
        pSkipMany (pChar '\n')
        return (Paragraph f)
 
 pControl :: ControlParser Control
-pControl = 
+pControl =
     do pSkipMany (pChar '\n')
        c <- pMany pParagraph
        return (Control c)
@@ -104,7 +108,7 @@
 -- parseControlFromFile :: FilePath -> IO (Either String Control)
 
 instance ControlFunctions C.ByteString where
-    parseControlFromFile fp = 
+    parseControlFromFile fp =
         do c <- C.readFile fp
            case parse pControl c of
              Nothing -> return (Left (newErrorMessage (Message ("Failed to parse " ++ fp)) (newPos fp 0 0)))
@@ -135,13 +139,13 @@
       dropWhileEnd func = LL.reverse . LL.dropWhile func . LL.reverse -- foldr (\x xs -> if func x && LL.null xs then LL.empty else LL.cons x xs) empty
       protect :: (LL.StringLike a, LL.ListLike a Word8) => a -> a
       protect l = maybe LL.empty (\ c -> if isHorizSpace c then l else LL.cons (ord' ' ' :: Word8) l) (LL.find (const True :: Word8 -> Bool) l)
-      isSpace' = isSpace . chr'
+      -- isSpace' = isSpace . chr'
       isHorizSpace c = elem c (map ord' " \t")
       ord' = fromIntegral . ord
-      chr' = chr . fromIntegral
+      -- chr' = chr . fromIntegral
 
 {-
-main = 
+main =
     do [fp] <- getArgs
        C.readFile fp >>= \c -> maybe (putStrLn "failed.") (print . length . fst) (parse pControl c)
 -}
@@ -168,13 +172,32 @@
 
 newtype Parser state a = Parser { unParser :: (state -> Result (a, state)) }
 
+instance Functor (Parser state) where
+    fmap f m =
+        Parser $ \ state ->
+            let r = (unParser m) state in
+            case r of
+              Ok (a,state') -> Ok (f a,state')
+              Empty -> Empty
+              Fail -> Fail
+
+instance Applicative (Parser state) where
+    pure = return
+    (<*>) = ap
+
+instance Alternative (Parser state) where
+    empty =
+        Parser $ \state ->
+            (unParser mzero) state
+    (<|>) = mplus
+
 instance Monad (Parser state) where
     return a = Parser (\s -> Ok (a,s))
     m >>= f =
         Parser $ \state ->
             let r = (unParser m) state in
             case r of
-              Ok (a,state') -> 
+              Ok (a,state') ->
                   case unParser (f a) $ state' of
                     Empty -> Fail
                     o -> o
@@ -188,7 +211,7 @@
                         Empty -> p2 s
                         o -> o
                )
-        
+
 --       Parser (\s -> maybe (p2 s) (Just) (p1 s))
 
 
@@ -199,10 +222,6 @@
 _pFail = Parser (const Empty)
 
 
-(<|>) :: Parser state a -> Parser state a -> Parser state a
-(<|>) = mplus
-
-
 satisfy :: (Char -> Bool) -> Parser C.ByteString Char
 satisfy f =
     Parser $ \bs ->
@@ -236,14 +255,14 @@
     Parser $ \bs -> Ok ((), C.dropWhile p bs)
 
 pMany ::  Parser st a -> Parser st [a]
-pMany p 
+pMany p
     = scan id
     where
       scan f = do x <- p
                   scan (\tail -> f (x:tail))
                <|> return (f [])
 
-notEmpty :: Parser st C.ByteString -> Parser st C.ByteString 
+notEmpty :: Parser st C.ByteString -> Parser st C.ByteString
 notEmpty (Parser p) =
     Parser $ \s -> case p s of
                      o@(Ok (a, _s)) ->
@@ -262,7 +281,7 @@
 pSkipMany p = scan
     where
       scan = (p >> scan) <|> return ()
-       
+
 _pSkipMany1 :: Parser st a -> Parser st ()
 _pSkipMany1 p = p >> pSkipMany p
 
diff --git a/Debian/Control/Common.hs b/Debian/Control/Common.hs
--- a/Debian/Control/Common.hs
+++ b/Debian/Control/Common.hs
@@ -169,7 +169,7 @@
       result <- parseControlFromHandle cmd outh
       either (return . Left . show) (finish handle) result
     where
-      finish handle control = 
+      finish handle control =
           do
             exitCode <- waitForProcess handle
             case exitCode of
@@ -185,7 +185,7 @@
 md5sumField p =
     case fieldValue "MD5Sum" p of
       m@(Just _) -> m
-      Nothing -> 
+      Nothing ->
           case fieldValue "Md5Sum" p of
             m@(Just _) -> m
             Nothing -> fieldValue "MD5sum" p
diff --git a/Debian/Control/String.hs b/Debian/Control/String.hs
--- a/Debian/Control/String.hs
+++ b/Debian/Control/String.hs
@@ -40,14 +40,14 @@
 -- * ControlFunctions
 
 instance ControlFunctions String where
-    parseControlFromFile filepath = 
-        parseFromFile pControl filepath 
-    parseControlFromHandle sourceName handle = 
+    parseControlFromFile filepath =
+        parseFromFile pControl filepath
+    parseControlFromHandle sourceName handle =
         E.try (hGetContents handle) >>=
         either (\ (e :: E.SomeException) -> error ("parseControlFromHandle String: Failure parsing " ++ sourceName ++ ": " ++ show e)) (return . parseControl sourceName)
-    parseControl sourceName c = 
+    parseControl sourceName c =
         parse pControl sourceName c
-    lookupP fieldName (Paragraph paragraph) = 
+    lookupP fieldName (Paragraph paragraph) =
         find (hasFieldName (map toLower fieldName)) paragraph
         where hasFieldName name (Field (fieldName',_)) = name == map toLower fieldName'
               hasFieldName _ _ = False
diff --git a/Debian/Extra/Files.hs b/Debian/Extra/Files.hs
--- a/Debian/Extra/Files.hs
+++ b/Debian/Extra/Files.hs
@@ -9,9 +9,9 @@
 import System.IO (hPutStr, hClose, openBinaryTempFile)
 
 withTemporaryFile :: MonadIO m
-                  => (FilePath -> m a)	-- ^ The function we want to pass a FilePath to
-                  -> String		-- ^ The text that the file should contain
-                  -> m a		-- ^ The function's return value
+                  => (FilePath -> m a)  -- ^ The function we want to pass a FilePath to
+                  -> String             -- ^ The text that the file should contain
+                  -> m a                -- ^ The function's return value
 withTemporaryFile f text =
     do path <- liftIO writeTemporaryFile
        result <- f path
diff --git a/Debian/GenBuildDeps.hs b/Debian/GenBuildDeps.hs
--- a/Debian/GenBuildDeps.hs
+++ b/Debian/GenBuildDeps.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE FlexibleContexts, OverloadedStrings, RecordWildCards, ScopedTypeVariables, TemplateHaskell #-}
+{-# LANGUAGE CPP, FlexibleContexts, OverloadedStrings, RecordWildCards, ScopedTypeVariables, TemplateHaskell #-}
 -- |Figure out the dependency relation between debianized source
 -- directories.  The code to actually solve these dependency relations
 -- for a particular set of binary packages is in Debian.Repo.Dependency.
@@ -23,27 +23,29 @@
     , getSourceOrder
     ) where
 
+#if !MIN_VERSION_base(4,8,0)
 import           Control.Applicative ((<$>))
+#endif
 import           Control.Exception (throw)
-import		 Control.Monad (filterM)
-import		 Data.Graph (Graph, Edge, Vertex, buildG, topSort, reachable, transposeG, edges, scc)
-import		 Data.List
+import           Control.Monad (filterM)
+import           Data.Graph (Graph, Edge, Vertex, buildG, topSort, reachable, transposeG, edges, scc)
+import           Data.List
 import qualified Data.Map as Map
-import		 Data.Maybe
+import           Data.Maybe
 import qualified Data.Set as Set
 import           Data.Tree as Tree (Tree(Node, rootLabel, subForest))
-import		 Debian.Control (parseControlFromFile)
-import		 Debian.Control.Policy (HasDebianControl, DebianControl, ControlFileError(..), validateDebianControl, debianSourcePackageName, debianBinaryPackageNames, debianBuildDeps, debianBuildDepsIndep)
+import           Debian.Control (parseControlFromFile)
+import           Debian.Control.Policy (HasDebianControl, DebianControl, ControlFileError(..), validateDebianControl, debianSourcePackageName, debianBinaryPackageNames, debianBuildDeps, debianBuildDepsIndep)
 import           Debian.Loc (__LOC__)
-import		 Debian.Relation
-import		 Debian.Relation.Text ()
-import		 System.Directory (getDirectoryContents, doesFileExist)
+import           Debian.Relation
+import           Debian.Relation.Text ()
+import           System.Directory (getDirectoryContents, doesFileExist)
 
 -- | This type describes the build dependencies of a source package.
 data DepInfo = DepInfo {
-      sourceName :: SrcPkgName		-- ^ source package name
-    , relations :: Relations		-- ^ dependency relations
-    , binaryNames :: [BinPkgName]	-- ^ binary dependency names (is this a function of relations?)
+      sourceName :: SrcPkgName          -- ^ source package name
+    , relations :: Relations            -- ^ dependency relations
+    , binaryNames :: [BinPkgName]       -- ^ binary dependency names (is this a function of relations?)
     } deriving Show
 
 instance Eq DepInfo where
diff --git a/Debian/Relation/ByteString.hs b/Debian/Relation/ByteString.hs
--- a/Debian/Relation/ByteString.hs
+++ b/Debian/Relation/ByteString.hs
@@ -13,7 +13,7 @@
     -- * Relation Parser
     , RelParser
     , ParseRelations(..)
-    ) where 
+    ) where
 
 import qualified Data.ByteString.Char8 as C
 
diff --git a/Debian/Relation/Common.hs b/Debian/Relation/Common.hs
--- a/Debian/Relation/Common.hs
+++ b/Debian/Relation/Common.hs
@@ -59,10 +59,10 @@
 
 instance Ord Relation where
     compare (Rel pkgName1 mVerReq1 _mArch1) (Rel pkgName2 mVerReq2 _mArch2) =
-	case compare pkgName1 pkgName2 of
-	     LT -> LT
-	     GT -> GT
-	     EQ -> compare mVerReq1 mVerReq2
+        case compare pkgName1 pkgName2 of
+             LT -> LT
+             GT -> GT
+             EQ -> compare mVerReq1 mVerReq2
 
 data ArchitectureReq
     = ArchOnly (Set Arch)
diff --git a/Debian/Relation/String.hs b/Debian/Relation/String.hs
--- a/Debian/Relation/String.hs
+++ b/Debian/Relation/String.hs
@@ -52,7 +52,7 @@
 -- are omitted and it is possible to parse relations without them.
 pRelations :: RelParser Relations
 pRelations = do -- rel <- sepBy pOrRelation (char ',')
-		rel <- many pOrRelation
+                rel <- many pOrRelation
                 eof
                 return rel
 
@@ -92,34 +92,34 @@
 pVerReq =
     do char '<'
        (do char '<' <|> char ' ' <|> char '\t'
-	   return $ SLT
+           return $ SLT
         <|>
         do char '='
-	   return $ LTE)
+           return $ LTE)
     <|>
     do string "="
        return $ EEQ
     <|>
     do char '>'
        (do char '='
- 	   return $ GRE
+           return $ GRE
         <|>
         do char '>' <|> char ' ' <|> char '\t'
-	   return $ SGR)
+           return $ SGR)
 
 pMaybeArch :: RelParser (Maybe ArchitectureReq)
 pMaybeArch =
     do char '['
        (do archs <- pArchExcept
-	   char ']'
+           char ']'
            skipMany whiteChar
-	   return (Just (ArchExcept (fromList . map parseArchExcept $ archs)))
-	<|>
-	do archs <- pArchOnly
-	   char ']'
+           return (Just (ArchExcept (fromList . map parseArchExcept $ archs)))
+        <|>
+        do archs <- pArchOnly
+           char ']'
            skipMany whiteChar
-	   return (Just (ArchOnly (fromList . map parseArch $ archs)))
-	)
+           return (Just (ArchOnly (fromList . map parseArch $ archs)))
+        )
     <|>
     return Nothing
 
diff --git a/Debian/Relation/Text.hs b/Debian/Relation/Text.hs
--- a/Debian/Relation/Text.hs
+++ b/Debian/Relation/Text.hs
@@ -13,7 +13,7 @@
     -- * Relation Parser
     , RelParser
     , ParseRelations(..)
-    ) where 
+    ) where
 
 import qualified Data.Text as T
 
diff --git a/Debian/Report.hs b/Debian/Report.hs
--- a/Debian/Report.hs
+++ b/Debian/Report.hs
@@ -48,7 +48,7 @@
 -- see also: |trumpedMap|
 trumped :: Fetcher -- ^ function for downloading package indexes
         -> FilePath -- ^ cache directory to store index files in (must already exist)
-        -> String -- ^ binary architecture 
+        -> String -- ^ binary architecture
         -> [DebSource] -- ^ sources.list a
         -> [DebSource] -- ^ sources.list b
         -> IO (M.Map Text (DebianVersion, DebianVersion)) -- ^ a map of trumped package names to (version a, version b)
diff --git a/Debian/Sources.hs b/Debian/Sources.hs
--- a/Debian/Sources.hs
+++ b/Debian/Sources.hs
@@ -89,7 +89,7 @@
       quoteWords' :: String -> [String]
       quoteWords' [] = []
       quoteWords' str =
-          case break (flip elem " [\"") str of
+          case break (flip elem (" [\"" :: String)) str of
             ([],[]) -> []
             (w, []) -> [w]
             (w, (' ':rest)) -> w : (quoteWords' (dropWhile (==' ') rest))
diff --git a/Debian/Time.hs b/Debian/Time.hs
--- a/Debian/Time.hs
+++ b/Debian/Time.hs
@@ -1,24 +1,27 @@
+{-# LANGUAGE CPP #-}
 module Debian.Time where
 
 import Data.Time
-import Data.Time.Clock.POSIX
+#if !MIN_VERSION_time(1,5,0)
 import System.Locale (defaultTimeLocale)
+#endif
+import Data.Time.Clock.POSIX
 import System.Posix.Types
 
 -- * Time Helper Functions
 
-rfc822DateFormat :: String
-rfc822DateFormat = "%a, %d %b %Y %T %z"
+rfc822DateFormat' :: String
+rfc822DateFormat' = "%a, %d %b %Y %T %z"
 
 epochTimeToUTCTime :: EpochTime -> UTCTime
 epochTimeToUTCTime = posixSecondsToUTCTime . fromIntegral . fromEnum
 
 formatTimeRFC822 :: (FormatTime t) => t -> String
-formatTimeRFC822 = formatTime defaultTimeLocale rfc822DateFormat
+formatTimeRFC822 = formatTime defaultTimeLocale rfc822DateFormat'
 
 parseTimeRFC822 :: (ParseTime t) => String -> Maybe t
-parseTimeRFC822 = parseTime defaultTimeLocale rfc822DateFormat
+parseTimeRFC822 = parseTime defaultTimeLocale rfc822DateFormat'
 
 getCurrentLocalRFC822Time :: IO String
-getCurrentLocalRFC822Time = getCurrentTime >>= utcToLocalZonedTime >>= return . formatTime defaultTimeLocale rfc822DateFormat
+getCurrentLocalRFC822Time = getCurrentTime >>= utcToLocalZonedTime >>= return . formatTime defaultTimeLocale rfc822DateFormat'
 
diff --git a/Debian/UTF8.hs b/Debian/UTF8.hs
--- a/Debian/UTF8.hs
+++ b/Debian/UTF8.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
 -- | There are old index files that have funky characters like 'ø'
 -- that are not properly UTF8 encoded.  As far as I can tell, these
 -- files are otherwise plain ascii, so just naivelyinsert the
@@ -7,7 +8,9 @@
     , readFile
     ) where
 
+#if !MIN_VERSION_base(4,8,0)
 import Control.Applicative ((<$>))
+#endif
 import qualified Data.ByteString.Char8 as B (concat)
 import qualified Data.ByteString.Lazy.Char8 as L (ByteString, readFile, toChunks)
 import Data.Char (chr)
diff --git a/Debian/Util/FakeChanges.hs b/Debian/Util/FakeChanges.hs
--- a/Debian/Util/FakeChanges.hs
+++ b/Debian/Util/FakeChanges.hs
@@ -32,8 +32,8 @@
     | VersionMismatch [Maybe String]
     deriving (Read, Show, Eq, Typeable, Data)
 
-data Files 
-    = Files { dsc :: Maybe (FilePath, Paragraph) 
+data Files
+    = Files { dsc :: Maybe (FilePath, Paragraph)
             , debs :: [(FilePath, Paragraph)]
             , tar :: Maybe FilePath
             , diff :: Maybe FilePath
@@ -42,12 +42,12 @@
 fakeChanges :: [FilePath] -> IO (FilePath, String)
 fakeChanges fps =
     do files <- loadFiles fps
-       let version    	= getVersion files
+       let version      = getVersion files
            source       = getSource files
            maintainer   = getMaintainer files
            arches       = getArches files
            binArch      = getBinArch files
-           dist	        = "unstable"
+           dist         = "unstable"
            urgency      = "low"
            (invalid, binaries) = unzipEithers $ map (debNameSplit . fst) (debs files)
        when (not . null $ invalid) (error $ "Some .deb names are invalid: " ++ show invalid)
@@ -119,9 +119,9 @@
       debSource (deb,p) =
           case (fieldValue "Source" p) of
             (Just v) -> v
-            Nothing -> 
+            Nothing ->
                 case fieldValue "Package" p of
-                  (Just v) -> v 
+                  (Just v) -> v
                   Nothing -> error $ "Could not find Source or Package field in " ++ deb
 
 
@@ -165,7 +165,7 @@
 mkFileLine fp
     | ".deb" `isSuffixOf` fp =
         do sum <- L.readFile fp >>= return . show . MD5.md5
-           size <- liftM fileSize $ getFileStatus fp 
+           size <- liftM fileSize $ getFileStatus fp
            (Control (p:_)) <- Deb.fields fp
            return $ concat [ " ", sum, " ", show size, " ", fromMaybe "unknown" (fieldValue "Section" p), " "
                            , fromMaybe "optional" (fieldValue "Priority" p), " ", (takeBaseName fp)
@@ -176,7 +176,7 @@
            return $ concat [ " ", sum, " ", show size, " ", "unknown", " "
                            , "optional"," ", (takeBaseName fp)
                            ]
-       
+
 -- more implementations can be found at:
 -- http://www.google.com/codesearch?hl=en&lr=&q=%22%5BEither+a+b%5D+-%3E+%28%5Ba%5D%2C%5Bb%5D%29%22&btnG=Search
 unzipEithers :: [Either a b] -> ([a],[b])
@@ -191,8 +191,8 @@
     case (takeFileName fp) =~ "^(.*)_(.*)_(.*).deb$" of
       [[_, name, version, arch]] -> Right (name, version, arch)
       _ -> Left fp
-    
 
+
 loadFiles :: [FilePath] -> IO Files
 loadFiles files =
        let (dscs', files'') = partition (isSuffixOf ".dsc") files'
@@ -213,7 +213,7 @@
          -- if (not . null $ errors) then throwDyn errors else return (debs, listToMaybe dscs, listToMaybe tars, listToMaybe diffs)
     where
       loadDsc :: FilePath -> IO (FilePath, Paragraph)
-      loadDsc dsc' = 
+      loadDsc dsc' =
           do res <- parseControlFromFile dsc'
              case  res of
                (Left e) -> error $ "Error parsing " ++ dsc' ++ "\n" ++ show e
@@ -229,7 +229,7 @@
 
 getUploader :: IO String
 getUploader =
-    do debFullName <- 
+    do debFullName <-
            do dfn <- try (getEnv "DEBFULLNAME")
               case dfn of
                 (Right n) -> return n
@@ -240,7 +240,7 @@
                          (Left (_ :: SomeException)) -> error $ "Could not determine user name, neither DEBFULLNAME nor USER enviroment variables were set."
        emailAddr <-
            do eml <- try (getEnv "DEBEMAIL")
-              case eml of 
+              case eml of
                 (Right e) -> return e
                 (Left (_ :: SomeException)) ->
                     do eml' <- try (getEnv "EMAIL")
diff --git a/Debian/Version.hs b/Debian/Version.hs
--- a/Debian/Version.hs
+++ b/Debian/Version.hs
@@ -1,7 +1,7 @@
 -- |A module for parsing, comparing, and (eventually) modifying debian version
 -- numbers. <http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version>
-module Debian.Version 
-    (DebianVersion -- |Exported abstract because the internal representation is likely to change 
+module Debian.Version
+    (DebianVersion -- |Exported abstract because the internal representation is likely to change
     , prettyDebianVersion
     , parseDebianVersion
     , epoch
@@ -9,7 +9,7 @@
     , revision
     , buildDebianVersion
     , evr
-    ) where 
+    ) where
 
 import Debian.Version.Common
 import Debian.Version.String ()
diff --git a/Debian/Version/ByteString.hs b/Debian/Version/ByteString.hs
--- a/Debian/Version/ByteString.hs
+++ b/Debian/Version/ByteString.hs
@@ -9,7 +9,7 @@
 
 import Debian.Version.Common
 import Debian.Version.Internal
-    
+
 instance ParseDebianVersion C.ByteString where
     parseDebianVersion byteStr =
         let str = C.unpack byteStr in
diff --git a/Debian/Version/Common.hs b/Debian/Version/Common.hs
--- a/Debian/Version/Common.hs
+++ b/Debian/Version/Common.hs
@@ -3,10 +3,10 @@
 {-# LANGUAGE FlexibleInstances #-}
 {-# OPTIONS -fno-warn-orphans -fno-warn-unused-do-bind #-}
 module Debian.Version.Common
-    ( DebianVersion -- |Exported abstract because the internal representation is likely to change 
+    ( DebianVersion -- |Exported abstract because the internal representation is likely to change
     , prettyDebianVersion
     , ParseDebianVersion(..)
-    , evr		-- DebianVersion -> (Maybe Int, String, Maybe String)
+    , evr               -- DebianVersion -> (Maybe Int, String, Maybe String)
     , epoch
     , version
     , revision
@@ -106,13 +106,13 @@
 
 showN :: Found Numeric -> String
 showN (Found (Numeric n nn)) = show n ++ maybe "" showNN nn
-showN (Simulated _) = "" 
+showN (Simulated _) = ""
 -}
 
 parseDV :: CharParser () (Found Int, NonNumeric, Found NonNumeric)
 parseDV =
     do skipMany $ oneOf " \t"
-       e <- parseEpoch 
+       e <- parseEpoch
        upstreamVersion <- parseNonNumeric True True
        debianRevision <- option (Simulated (NonNumeric "" (Simulated (Numeric 0 Nothing)))) (char '-' >> parseNonNumeric True False >>= return . Found)
        return (e, upstreamVersion, debianRevision)
@@ -120,8 +120,8 @@
 parseEpoch :: CharParser () (Found Int)
 parseEpoch =
     option (Simulated 0) (try (many1 digit >>= \d -> char ':' >> return (Found (read d))))
-       
 
+
 parseNonNumeric :: Bool -> Bool -> CharParser () NonNumeric
 parseNonNumeric zeroOk upstream =
     do nn <- (if zeroOk then many else many1) ((noneOf "-0123456789") <|> (if upstream then upstreamDash else pzero))
@@ -146,7 +146,7 @@
 compareTest str1 str2 =
     let v1 = either (error . show) id $ parse parseDV str1 str1
         v2 = either (error . show) id $ parse parseDV str2 str2
-        in 
+        in
           compare v1 v2
 -}
 
@@ -157,7 +157,7 @@
 evr (DebianVersion s _) =
     let re = mkRegex "^(([0-9]+):)?(([^-]*)|((.*)-([^-]*)))$" in
     --                 (         ) (        (            ))
-    --		        (   e  )    (  v  )  (v2) (  r  )
+    --                  (   e  )    (  v  )  (v2) (  r  )
     case matchRegex re s of
       Just ["", _, _, v, "", _, _] -> (Nothing, v, Nothing)
       Just ["", _, _, _, _,  v, r] -> (Nothing, v, Just r)
diff --git a/Debian/Version/Text.hs b/Debian/Version/Text.hs
--- a/Debian/Version/Text.hs
+++ b/Debian/Version/Text.hs
@@ -9,7 +9,7 @@
 
 import Debian.Version.Common
 import Debian.Version.Internal
-    
+
 instance ParseDebianVersion T.Text where
     parseDebianVersion text =
         let str = T.unpack text in
diff --git a/Setup.hs b/Setup.hs
--- a/Setup.hs
+++ b/Setup.hs
@@ -8,12 +8,4 @@
 import System.FilePath ((</>))
 import System.Process
 
-main = copyFile "debian/changelog" "changelog" >>
-       defaultMainWithHooks simpleUserHooks {
-         postBuild = \ _ _ _ lbi -> runTestScript lbi
-       , runTests = \ _ _ _ lbi -> runTestScript lbi
-       }
-
-runTestScript lbi =
-    system (buildDir lbi </> "debian-tests/debian-tests") >>= \ code ->
-    if code == ExitSuccess then return () else error "Test Failure"
+main = copyFile "debian/changelog" "changelog" >> defaultMainWithHooks simpleUserHooks
diff --git a/Test/Control.hs b/Test/Control.hs
--- a/Test/Control.hs
+++ b/Test/Control.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE FlexibleInstances, OverloadedStrings, StandaloneDeriving #-}
+{-# LANGUAGE CPP, FlexibleInstances, OverloadedStrings, StandaloneDeriving #-}
 module Control where
 
 import Test.HUnit
@@ -17,8 +17,10 @@
 import Text.PrettyPrint.HughesPJClass (Doc, text, pPrint)
 import Text.Regex.TDFA ((=~), MatchResult(..))
 
+#if !MIN_VERSION_pretty(1,1,2)
 instance Eq Doc where
     a == b = show a == show b
+#endif
 
 instance Eq DebianControl where
     a == b = unDebianControl a == unDebianControl b
diff --git a/Test/Main.hs b/Test/Main.hs
--- a/Test/Main.hs
+++ b/Test/Main.hs
@@ -7,7 +7,7 @@
 import Versions
 import SourcesList
 import Dependencies
-import Text.PrettyPrint.ANSI.Leijen (Doc, text, (<+>), (<$>), fillSep, renderPretty, displayS)
+import Text.PrettyPrint
 
 main =
     do (c,st) <- runTestText putTextToShowS (TestList (versionTests ++ sourcesListTests ++ dependencyTests ++ changesTests ++ controlTests ++ prettyTests))
@@ -26,14 +26,14 @@
                   "",
                   "Find all the packages referenced by the",
                   "second sources.list which trump packages",
-                  "find in the first sources.list."])
-                (displayS (renderPretty 1.0 40 (helpText "debian-report")) "")
+                  "found in the first sources.list."])
+                (renderStyle (style {lineLength = 60}) (helpText "debian-report"))
                ) ]
 
 helpText :: String -> Doc
 helpText progName =
-    (text "Usage:" <+> text progName <+> text "<old sources.list>" <+> text "<new sources.list>" <$>
-     text [] <$>
-     (fillSep $ map text $ words $ "Find all the packages referenced by the second sources.list which trump packages find in the first sources.list.") <$>
+    (text "Usage:" <+> text progName <+> text "<old sources.list>" <+> text "<new sources.list>" $$
+     text [] $$
+     (fsep $ map text $ words $ "Find all the packages referenced by the second sources.list which trump packages found in the first sources.list.") $$
      text []
     )
diff --git a/changelog b/changelog
--- a/changelog
+++ b/changelog
@@ -1,3 +1,16 @@
+haskell-debian (3.87.2) unstable; urgency=low
+
+  * Functor, Applicative, and Alternative instances for ghc-7.10
+  * Fiddle with imports and ifdefs to fix build
+
+ -- David Fox <dsf@seereason.com>  Sun, 22 Mar 2015 12:55:39 -0700
+
+haskell-debian (3.87.1) unstable; urgency=low
+
+  * Version bump to match cabal
+
+ -- David Fox <dsf@seereason.com>  Mon, 02 Mar 2015 13:13:00 -0800
+
 haskell-debian (3.86) unstable; urgency=low
 
   * Avoid dependency on th-orphans
diff --git a/debian.cabal b/debian.cabal
--- a/debian.cabal
+++ b/debian.cabal
@@ -1,5 +1,5 @@
 Name:           debian
-Version:        3.87.1
+Version:        3.87.2
 License:        BSD3
 License-File:   debian/copyright
 Author:         David Fox <dsf@seereason.com>, Jeremy Shaw <jeremy@seereason.com>, Clifford Beshers <beshers@seereason.com>
@@ -130,7 +130,7 @@
   Type: exitcode-stdio-1.0
   Hs-Source-Dirs: Test
   Main-Is: Main.hs
- Build-Depends: ansi-wl-pprint, base, debian, HUnit, parsec, regex-tdfa, text
+ Build-Depends: base, debian, HUnit, parsec, regex-tdfa, text
  if flag(pretty-new)
    Build-Depends: pretty >= 1.1.2
  else
diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,17 @@
+haskell-debian (3.87.2) unstable; urgency=low
+
+  * Functor, Applicative, and Alternative instances for ghc-7.10
+  * Fiddle with imports and ifdefs to fix build
+  * Switch from ansi-wl-pprint package to pretty
+
+ -- David Fox <dsf@seereason.com>  Sun, 22 Mar 2015 12:55:39 -0700
+
+haskell-debian (3.87.1) unstable; urgency=low
+
+  * Version bump to match cabal
+
+ -- David Fox <dsf@seereason.com>  Mon, 02 Mar 2015 13:13:00 -0800
+
 haskell-debian (3.86) unstable; urgency=low
 
   * Avoid dependency on th-orphans
