diff --git a/Codec/MIME/ContentType/Text/Directory.hs b/Codec/MIME/ContentType/Text/Directory.hs
--- a/Codec/MIME/ContentType/Text/Directory.hs
+++ b/Codec/MIME/ContentType/Text/Directory.hs
@@ -9,38 +9,71 @@
 -- This library implements all the required mechanisms in RFC 2425, which other
 -- libraries may use to implement parsing and generating specific profiles,
 -- such as vCard.
+
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE EmptyDataDecls #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE PatternGuards #-}
+
 module Codec.MIME.ContentType.Text.Directory
     ( -- * Types
-      Directory, Property(..)
-    , Type(..), Parameter(..)
-    , Value(..), Rfc2425Value, PrintValue(..), ValueParser
-    , nakedType, (@@)
+      Directory
+    , Property(..)
+    , Type(..)
+    , Parameter(..)
+    , Value(..)
+    , Rfc2425Value
+    , PrintValue(..)
+    , ValueParser
+    , nakedType
+    , (@@)
     , lookupParameter
     -- * Encoding\/decoding values
-    , decodeValue, encodeValue
+    , decodeValue
+    , encodeValue
     , escape
     -- * Parsing
-    , parseDirectory, parseDirectory', fromList, groupByBeginEnd
+    , parseDirectory
+    , parseDirectory'
+    , fromList
+    , groupByBeginEnd
     -- ** Value Parsers
-    , pa_URI, pa_text, pa_date, pa_time, pa_dateTime
-    , pa_integer, pa_boolean, pa_float, pa_textList
+    , pa_URI
+    , pa_text
+    , pa_date
+    , pa_time
+    , pa_dateTime
+    , pa_integer
+    , pa_boolean
+    , pa_float
+    , pa_textList
     -- ** Value parser combinators
     , many
     -- * Printing
-    , printDirectory, printDirectory', printProperty) where
+    , printDirectory
+    , printDirectory'
+    , printProperty
+    ) where
 
-import Data.Time
-import System.Locale
-import Data.Char (toLower)
+import Control.Applicative hiding (many)
+import Data.Time (Day, DiffTime, ParseTime, UTCTime, utctDayTime)
+#if MIN_VERSION_time(1,5,0)
+import Data.Time (TimeLocale, defaultTimeLocale, iso8601DateFormat, parseTimeOrError)
+#else
+import Data.Time (readTime)
+#endif
 import Data.Maybe (fromJust)
 import Text.Regex.PCRE.ByteString.Lazy
 import qualified Codec.Binary.Base64.String as Base64
 import qualified Data.ByteString.Lazy.Char8 as B
 import qualified Data.ByteString.Lazy.Char8.Caseless as I
 import qualified Data.Map as Map
-import Control.Monad (liftM)
+import Control.Monad (liftM, ap)
 import System.IO.Unsafe
-
+#if !MIN_VERSION_time(1,5,0)
+import System.Locale (TimeLocale, defaultTimeLocale, iso8601DateFormat)
+#endif
+import Prelude -- silence AMP warnings.
 
 -- | A directory is a list of groups of semantically related entities. These
 -- entities are grouped together in RFC 2425 using @BEGIN ... END@ pairs.
@@ -74,7 +107,7 @@
 
 -- | Find the parameter values for a given parameter name.
 lookupParameter :: I.ByteString -> [Parameter] -> Maybe [B.ByteString]
-lookupParameter pname [] = Nothing
+lookupParameter _ [] = Nothing
 lookupParameter pname (p:ps)
     | param_name p == pname = Just (param_values p)
     | otherwise = lookupParameter pname ps
@@ -126,13 +159,20 @@
 
 newtype P a = P { unP :: B.ByteString -> (a, B.ByteString) }
 
+instance Functor P where
+    fmap = liftM
+
+instance Applicative P where
+    pure x = P $ \s -> (x, s)
+    (<*>) = ap
+
 instance Monad P where
-    return x = P $ \s -> (x, s)
+    return = pure
     m >>= k = P $ \s -> let (a, s') = unP m s in unP (k a) s'
 
-p :: B.ByteString   -- ^ Text of the regular expression.
+pattern :: B.ByteString   -- ^ Text of the regular expression.
   -> P B.ByteString -- ^ The matching part of the input.
-p pat =
+pattern pat =
     let Right r = unsafePerformIO $ compile compBlank execAnchored pat
     in P $ \s -> unsafePerformIO $ do
                    Right result <- regexec r s
@@ -180,6 +220,7 @@
     where f p (ps:pss) | p @@ "begin" =
                            [] : (p:ps) : pss
           f p (ps:pss) = (p:ps):pss
+          f _ _ = error "impossible."
 
 -- | Build a directory from a list of properties.
 fromList :: [Property u] -> Directory u
@@ -200,7 +241,8 @@
   params <- case sept of
               ";" -> pa_parameterList
               ":" -> return []
-  rest <- p ".*$"
+              _ -> error "pa_property: bad separator."
+  rest <- pattern ".*$"
   let group = if B.null groupt then Nothing else Just (I.unsensitize groupt)
   let typ = Type { type_group = group, type_name = I.unsensitize typt }
       mkprop v = Prop { prop_type = typ
@@ -224,14 +266,17 @@
              ps <- case sep of
                      ';' -> aux
                      ':' -> return []
+                     _ -> error "pa_parameterList: bad separator."
              return $ Param { param_name = I.unsensitize name, param_values = vs } : ps
 
 -- | Properties may indicate an encoding, so this decodes the value
 -- if need be before parsing.
+decodeValue :: [Parameter] -> B.ByteString -> B.ByteString
 decodeValue = codec Base64.decode
 
 -- | Properties may indicate an encoding, so this encodes the value if need be
 -- after printing.
+encodeValue :: [Parameter] -> B.ByteString -> B.ByteString
 encodeValue = codec Base64.encode
 
 codec :: (String -> String) -> [Parameter] -> B.ByteString -> B.ByteString
@@ -244,6 +289,14 @@
 
 -- A few canned parsers for value types defined in rfc2425
 
+-- | time-1.4 compat wrapper.
+parseTime :: ParseTime t => TimeLocale -> String -> String -> t
+#if MIN_VERSION_time(1,5,0)
+parseTime = parseTimeOrError True
+#else
+parseTime = readTime
+#endif
+
 pa_URI :: ValueParser u
 pa_URI _ = (:[]) . Text
 
@@ -253,16 +306,16 @@
 
 pa_date :: ValueParser u
 pa_date _ =
-    (:[]) . Date . readTime defaultTimeLocale (iso8601DateFormat Nothing) . B.unpack
+    (:[]) . Date . parseTime defaultTimeLocale (iso8601DateFormat Nothing) . B.unpack
 
 pa_time :: ValueParser u
 pa_time _ =
-    (:[]) . Time . utctDayTime . readTime defaultTimeLocale "%T" . B.unpack
+    (:[]) . Time . utctDayTime . parseTime defaultTimeLocale "%T" . B.unpack
 
 pa_dateTime :: ValueParser u
 pa_dateTime _ =
     (:[]) . DateTime .
-    readTime defaultTimeLocale (iso8601DateFormat (Just "T%T")) .
+    parseTime defaultTimeLocale (iso8601DateFormat (Just "T%T")) .
     B.unpack
 
 pa_integer :: ValueParser u
@@ -287,6 +340,7 @@
                             B.append "\r\n" xs : xss
           f '\\' (xs:xss) | Just ('\\',_) <- B.uncons xs = B.cons '\\' xs : xss
           f x (xs:xss) = B.cons x xs : xss
+          f _ _ = error "impossible"
 
 -- | Take a parser for single values to a parser for a list of values. This
 -- assumes that the separator between values is the "," character, and that
diff --git a/Data/ByteString/Lazy/Char8/Caseless.hs b/Data/ByteString/Lazy/Char8/Caseless.hs
--- a/Data/ByteString/Lazy/Char8/Caseless.hs
+++ b/Data/ByteString/Lazy/Char8/Caseless.hs
@@ -1,17 +1,29 @@
 -- | A variant of ByteString where strings differing in the case of some of
 -- its characters are identified.
+
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+
 module Data.ByteString.Lazy.Char8.Caseless
-    (ByteString, sensitize, unsensitize, concat, intercalate, pack, unpack) where
+    ( ByteString
+    , sensitize
+    , unsensitize
+    , concat
+    , intercalate
+    , pack
+    , unpack
+    ) where
 
 import qualified Data.ByteString.Lazy.Char8 as B
 import Data.Char (toLower)
 import GHC.Exts (IsString)
-import Data.Monoid (Monoid)
-import Prelude hiding (concat)
+import Data.Monoid
 #if defined(__GLASGOW_HASKELL__)
 import Data.Typeable (Typeable)
 import Data.Data (Data)
 #endif
+import Prelude hiding (concat)
 
 -- | Wrapper for case insensitive strings.
 newtype ByteString = I B.ByteString
diff --git a/mime-directory.cabal b/mime-directory.cabal
--- a/mime-directory.cabal
+++ b/mime-directory.cabal
@@ -1,8 +1,8 @@
 name:           mime-directory
-version:        0.5.1
+version:        0.5.2
 author:         Mathieu Boespflug
 maintainer:     Mathieu Boespflug <mboes - at - tweag.net>
-homepage:       http://code.haskell.org/~mboes/mime-directory.git
+homepage:       http://github.com/mboes/mime-directory
 synopsis:       A library for parsing/printing the text/directory mime type.
 description:
         A library for parsing\/printing the text\/directory mime type.
@@ -12,15 +12,20 @@
 copyright:      (c) 2008. Mathieu Boespflug <mboes - at - tweag.net>
 cabal-version:  >= 1.6.0
 build-type:     Simple
-tested-with:    GHC == 6.10
+tested-with:    GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.2
 
 library
-        build-depends:   base >= 3 && < 5, bytestring >= 0.9, regex-pcre >= 0.94,
-                         old-locale, time >= 1.1, containers, base64-string
-        extensions:      CPP, OverloadedStrings, EmptyDataDecls, PatternGuards
-                         GeneralizedNewtypeDeriving, DeriveDataTypeable
-        exposed-modules: Codec.MIME.ContentType.Text.Directory
-                         Data.ByteString.Lazy.Char8.Caseless
+  build-depends:
+    base >= 3 && < 5,
+    base64-string,
+    bytestring >= 0.9,
+    containers,
+    old-locale,
+    regex-pcre >= 0.94,
+    time >= 1.4
+  exposed-modules:
+    Codec.MIME.ContentType.Text.Directory
+    Data.ByteString.Lazy.Char8.Caseless
 
 source-repository head
   type:     git
