diff --git a/.travis.yml b/.travis.yml
index 54d582882c84b3d25822c555f735bbf981afacf3..01462704e8dcfd1893b9cbd68d8fdbe2045692c1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,12 +26,6 @@ before_cache:
 
 matrix:
   include:
-    - compiler: "ghc-7.0.4"
-    # env: TEST=--disable-tests BENCH=--disable-benchmarks
-      addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.0.4], sources: [hvr-ghc]}}
-    - compiler: "ghc-7.2.2"
-    # env: TEST=--disable-tests BENCH=--disable-benchmarks
-      addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.2.2], sources: [hvr-ghc]}}
     - compiler: "ghc-7.4.2"
     # env: TEST=--disable-tests BENCH=--disable-benchmarks
       addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.4.2], sources: [hvr-ghc]}}
diff --git a/ChangeLog.md b/ChangeLog.md
index e8d6a2f21d843a1e3f11e210f4aba0bc580bd37b..8b88b63c1861169f0d79ba32affc57957a4ea574 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,5 +1,29 @@
+### 3.1.13.0
+
+- Add official support for [`SafeHaskell`](http://downloads.haskell.org/~ghc/latest/docs/html/users_guide/safe_haskell.html)
+
+    **NOTE**: This is the first version whose `SafeHaskell` properties
+    have become an intentional part of the API contract; previous
+    versions were merely accidentally safe-inferred (or not depending
+    on various factors; in other words, this was a fragile
+    property). If you rely on `SafeHaskell` to consider module imports
+    from `parsec` *safe*, this is the first version of `parsec` which
+    actually guarantees a well-defined state; you can declare this
+    requirement by either specifying
+
+        build-depends: parsec >= 3.1.13.0 && < 3.2
+
+    or, starting with `cabal-version:2.0`, via
+
+        build-depends: parsec ^>= 3.1.13.0
+
+- Drop support for GHC 7.0, GHC 7.2, and GHC 7.4.1; support window
+  starts with GHC 7.4.2.
+
 ### 3.1.12.0
 
+- Support limited to GHC 7.0 & GHC 7.2 only
+
 - Add `MonadFail` instance for `ParsecT`
 - Add `Semigroup`/`Monoid` instances for `ParsecT` (#80,#82)
 - Fix space leak in Applicative/Monad interface (#37)
diff --git a/parsec.cabal b/parsec.cabal
index cfcdad7c4dd0e23fa1859dd302220a918ca8964d..7c2a399fa5aa61b303f51fa0a42289b2b15c1af4 100644
--- a/parsec.cabal
+++ b/parsec.cabal
@@ -1,6 +1,6 @@
-cabal-version:  >= 1.10
+cabal-version:  1.12
 name:           parsec
-version:        3.1.12.0
+version:        3.1.13.0
 
 synopsis:       Monadic parser combinators
 description:    Parsec is designed from scratch as an industrial-strength parser
@@ -26,7 +26,7 @@ bug-reports:    https://github.com/haskell/parsec/issues
 category:       Parsing
 
 build-type:     Simple
-tested-with:    GHC ==8.2.2 || ==8.0.2 || ==7.10.3 || ==7.8.4 || ==7.6.3 || ==7.4.2 || ==7.2.2 || ==7.0.4
+tested-with:    GHC ==8.4.1 || ==8.2.2 || ==8.0.2 || ==7.10.3 || ==7.8.4 || ==7.6.3 || ==7.4.2
 
 extra-source-files: ChangeLog.md, README.md
 
@@ -64,10 +64,10 @@ library
         Text.ParserCombinators.Parsec.Token
 
     build-depends:
-        base       >= 4.3   && < 5,
-        mtl        >= 1.1   && < 2.3,
-        bytestring >= 0.9.1 && < 0.11,
-        text       >= 0.2   && < 1.3
+        base       >= 4.5.1   && < 4.12,
+        mtl        >= 1.1.1   && < 2.3,
+        bytestring >= 0.9.2.1 && < 0.11,
+        text       >= 0.11.3  && < 1.3
 
     default-language: Haskell2010
     other-extensions:
@@ -80,15 +80,19 @@ library
         MultiParamTypeClasses
         PolymorphicComponents
         StandaloneDeriving
+        Safe
+        Trustworthy
         UndecidableInstances
 
     ghc-options: -Wall
     if impl(ghc >= 8.0)
-        ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances
+        ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances -Wno-trustworthy-safe
     else
         -- provide/emulate `Control.Monad.Fail` and `Semigroup` API for pre-GHC8
         build-depends: fail == 4.9.*, semigroups == 0.18.*
 
+        if impl(ghc >= 7.10)
+            ghc-options: -fno-warn-trustworthy-safe
 
 test-suite parsec.
     type: exitcode-stdio-1.0
diff --git a/src/Text/Parsec.hs b/src/Text/Parsec.hs
index c9901d8c9d1cc973078c7d05e4c6189999e1b915..00d6228f02f90dcbeb7d0ea3985532ff71775e30 100644
--- a/src/Text/Parsec.hs
+++ b/src/Text/Parsec.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE Safe #-}
+
 {-|
 Module      :  Text.Parsec
 Copyright   :  (c) Daan Leijen 1999-2001, (c) Paolo Martini 2007
diff --git a/src/Text/Parsec/ByteString.hs b/src/Text/Parsec/ByteString.hs
index 962e1a13ee72f39f5f71d51e609c61df34612b86..61b6820cdee3c7416c2306d23554e5cac5a02f4e 100644
--- a/src/Text/Parsec/ByteString.hs
+++ b/src/Text/Parsec/ByteString.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE Safe #-}
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.Parsec.ByteString
diff --git a/src/Text/Parsec/ByteString/Lazy.hs b/src/Text/Parsec/ByteString/Lazy.hs
index 7982539a5354263fcfbbc7650640574865e75421..0186c856bf7e1275075ce67e985d1448bea44504 100644
--- a/src/Text/Parsec/ByteString/Lazy.hs
+++ b/src/Text/Parsec/ByteString/Lazy.hs
@@ -1,9 +1,11 @@
+{-# LANGUAGE Safe #-}
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.Parsec.ByteString.Lazy
 -- Copyright   :  (c) Paolo Martini 2007
 -- License     :  BSD-style (see the LICENSE file)
--- 
+--
 -- Maintainer  :  derek.a.elkins@gmail.com
 -- Stability   :  provisional
 -- Portability :  portable
diff --git a/src/Text/Parsec/Char.hs b/src/Text/Parsec/Char.hs
index 8e7027fac4a36ace1c27fd75f7be728e62d32620..e9ef599cb063e1d486f6f2c14aafb91c45f3cc60 100644
--- a/src/Text/Parsec/Char.hs
+++ b/src/Text/Parsec/Char.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE CPP, FlexibleContexts #-}
+{-# LANGUAGE CPP, FlexibleContexts, Safe #-}
 
 -----------------------------------------------------------------------------
 -- |
diff --git a/src/Text/Parsec/Combinator.hs b/src/Text/Parsec/Combinator.hs
index 4305d041ea8fb5f77d80615973f207029ac93b11..7ca759422ca6d26a4f25d8a3a67484d3c070e1ae 100644
--- a/src/Text/Parsec/Combinator.hs
+++ b/src/Text/Parsec/Combinator.hs
@@ -1,3 +1,6 @@
+-- due to Debug.Trace
+{-# LANGUAGE Trustworthy #-}
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.Parsec.Combinator
diff --git a/src/Text/Parsec/Error.hs b/src/Text/Parsec/Error.hs
index d1618f58e605ed1fe41a93883f42377795c04049..a406647387763853c5cfb950a6bf51a97d38aa69 100644
--- a/src/Text/Parsec/Error.hs
+++ b/src/Text/Parsec/Error.hs
@@ -1,4 +1,5 @@
 {-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE Safe #-}
 
 -----------------------------------------------------------------------------
 -- |
diff --git a/src/Text/Parsec/Expr.hs b/src/Text/Parsec/Expr.hs
index 8265e387adc548e134496f4f1a2c6b9688b605d7..b0fabdf31ef5f88348f0ccb11f034bfce4928bc9 100644
--- a/src/Text/Parsec/Expr.hs
+++ b/src/Text/Parsec/Expr.hs
@@ -1,5 +1,6 @@
 {-# LANGUAGE CPP #-}
 {-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE Safe #-}
 
 -----------------------------------------------------------------------------
 -- |
diff --git a/src/Text/Parsec/Language.hs b/src/Text/Parsec/Language.hs
index ee4909ecc3544b960bc2d8c7f4db4fcf7b88c27d..a3d68f9a924ac77a0c132d37107aca043475c0bc 100644
--- a/src/Text/Parsec/Language.hs
+++ b/src/Text/Parsec/Language.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE Safe #-}
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.Parsec.Language
diff --git a/src/Text/Parsec/Perm.hs b/src/Text/Parsec/Perm.hs
index be3361d19bb13c81d209e20ed66d8a0db6b92dcc..20f9c459ec70153f2077bfe5e3d927aee1974a5e 100644
--- a/src/Text/Parsec/Perm.hs
+++ b/src/Text/Parsec/Perm.hs
@@ -3,6 +3,7 @@
 {-# LANGUAGE ExistentialQuantification #-}
 {-# LANGUAGE FlexibleContexts #-}
 {-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE Safe #-}
 
 -----------------------------------------------------------------------------
 -- |
diff --git a/src/Text/Parsec/Pos.hs b/src/Text/Parsec/Pos.hs
index 7d710686ac7520bef3e049960c47a0ba539bd3ac..02a7b213b4459e05dd6a90119782ab37ec8077b8 100644
--- a/src/Text/Parsec/Pos.hs
+++ b/src/Text/Parsec/Pos.hs
@@ -1,4 +1,5 @@
 {-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE Safe #-}
 
 -----------------------------------------------------------------------------
 -- |
diff --git a/src/Text/Parsec/Prim.hs b/src/Text/Parsec/Prim.hs
index e075aa4ddcdc9d00c29954a219e3b8837140c3d6..5d5d01730be361836fd6da9ff8a02ad9fb1f559d 100644
--- a/src/Text/Parsec/Prim.hs
+++ b/src/Text/Parsec/Prim.hs
@@ -6,6 +6,7 @@
 {-# LANGUAGE FunctionalDependencies #-}
 {-# LANGUAGE MultiParamTypeClasses #-}
 {-# LANGUAGE PolymorphicComponents #-}
+{-# LANGUAGE Safe #-}
 {-# LANGUAGE StandaloneDeriving #-}
 {-# LANGUAGE UndecidableInstances #-}
 
diff --git a/src/Text/Parsec/String.hs b/src/Text/Parsec/String.hs
index 8f2ffa605932025ec7a6a3cb3ae5d0a5e21d4ec8..2bd3b527109ff17624b1960fd101a6bbc83de8b8 100644
--- a/src/Text/Parsec/String.hs
+++ b/src/Text/Parsec/String.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE Safe #-}
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.Parsec.String
diff --git a/src/Text/Parsec/Text.hs b/src/Text/Parsec/Text.hs
index 9904b8f7e6eec9e4f9d9678cb7bcf7a71f08b7bc..e9e6105f6b797236b3bbaae78239a223be36d0c4 100644
--- a/src/Text/Parsec/Text.hs
+++ b/src/Text/Parsec/Text.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE Safe #-}
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.Parsec.String
diff --git a/src/Text/Parsec/Text/Lazy.hs b/src/Text/Parsec/Text/Lazy.hs
index 9db8a916a5828d2936aa0ae28f6756c59196d907..fabae870fea5a86b9e52a2e5d85c0b759acd327c 100644
--- a/src/Text/Parsec/Text/Lazy.hs
+++ b/src/Text/Parsec/Text/Lazy.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE Safe #-}
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.Parsec.String
diff --git a/src/Text/Parsec/Token.hs b/src/Text/Parsec/Token.hs
index 6865e05bd477d557067bff8511f67f8956848039..9d7dbb550dd601f36f18ca118e3e166bee764964 100644
--- a/src/Text/Parsec/Token.hs
+++ b/src/Text/Parsec/Token.hs
@@ -2,6 +2,7 @@
 {-# LANGUAGE DeriveDataTypeable #-}
 {-# LANGUAGE FlexibleContexts #-}
 {-# LANGUAGE PolymorphicComponents #-}
+{-# LANGUAGE Safe #-}
 
 -----------------------------------------------------------------------------
 -- |
diff --git a/src/Text/ParserCombinators/Parsec.hs b/src/Text/ParserCombinators/Parsec.hs
index 156e04a216ca893cab561ffae971b4bd6eaa5bfa..bf812b17cb3076eb418ff46438f6c6534a34ab4e 100644
--- a/src/Text/ParserCombinators/Parsec.hs
+++ b/src/Text/ParserCombinators/Parsec.hs
@@ -1,15 +1,17 @@
+{-# LANGUAGE Safe #-}
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.ParserCombinators.Parsec
 -- Copyright   :  (c) Paolo Martini 2007
 -- License     :  BSD-style (see the LICENSE file)
--- 
+--
 -- Maintainer  :  derek.a.elkins@gmail.com
 -- Stability   :  provisional
 -- Portability :  portable
--- 
+--
 -- Parsec compatibility module
--- 
+--
 -----------------------------------------------------------------------------
 
 module Text.ParserCombinators.Parsec
diff --git a/src/Text/ParserCombinators/Parsec/Char.hs b/src/Text/ParserCombinators/Parsec/Char.hs
index 0ced93c87d9c4ae92bba261e38737ad8abd3297e..459e8566e426691c8a013ede4b57617da1a53f75 100644
--- a/src/Text/ParserCombinators/Parsec/Char.hs
+++ b/src/Text/ParserCombinators/Parsec/Char.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE Safe #-}
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.ParserCombinators.Parsec.Char
diff --git a/src/Text/ParserCombinators/Parsec/Combinator.hs b/src/Text/ParserCombinators/Parsec/Combinator.hs
index 3b6dfae300657ce537fa2471f758d571342718be..d636505e73c3a8e272c48e33d5973fab0cb01187 100644
--- a/src/Text/ParserCombinators/Parsec/Combinator.hs
+++ b/src/Text/ParserCombinators/Parsec/Combinator.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE Safe #-}
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.ParserCombinators.Parsec.Combinator
diff --git a/src/Text/ParserCombinators/Parsec/Error.hs b/src/Text/ParserCombinators/Parsec/Error.hs
index dc63cb517c4e7bb78501ecaf446f6b9f41dc3a20..dbb4ac73e31e2892249ae64ec06488c68b1bcbd2 100644
--- a/src/Text/ParserCombinators/Parsec/Error.hs
+++ b/src/Text/ParserCombinators/Parsec/Error.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE Safe #-}
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.ParserCombinators.Parsec.Error
diff --git a/src/Text/ParserCombinators/Parsec/Expr.hs b/src/Text/ParserCombinators/Parsec/Expr.hs
index 33d550ff8ab3722a1880b9484c446fb6dc6df5ae..667187d6cf0c1ec3991458572aa6bc9e4ecf502c 100644
--- a/src/Text/ParserCombinators/Parsec/Expr.hs
+++ b/src/Text/ParserCombinators/Parsec/Expr.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE Safe #-}
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.ParserCombinators.Parsec.Expr
diff --git a/src/Text/ParserCombinators/Parsec/Language.hs b/src/Text/ParserCombinators/Parsec/Language.hs
index a64f307d3088c89b3a3f2abcb9715b45449def65..23102684223b8dbee1da5ae9dd02dffe620c2256 100644
--- a/src/Text/ParserCombinators/Parsec/Language.hs
+++ b/src/Text/ParserCombinators/Parsec/Language.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE Safe #-}
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.ParserCombinators.Parsec.Language
diff --git a/src/Text/ParserCombinators/Parsec/Perm.hs b/src/Text/ParserCombinators/Parsec/Perm.hs
index 987d5077a444b9785c29ffe79ab5650eb897e30e..14f3b2e40b0c79b12684a941ce47527c66ce1d21 100644
--- a/src/Text/ParserCombinators/Parsec/Perm.hs
+++ b/src/Text/ParserCombinators/Parsec/Perm.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE Safe #-}
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.ParserCombinators.Parsec.Perm
diff --git a/src/Text/ParserCombinators/Parsec/Pos.hs b/src/Text/ParserCombinators/Parsec/Pos.hs
index 7870e48cef16861b32b7e922f53790f621b5b0b9..0f6aad985f0b4369f063ab914f3871c51f99baa3 100644
--- a/src/Text/ParserCombinators/Parsec/Pos.hs
+++ b/src/Text/ParserCombinators/Parsec/Pos.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE Safe #-}
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.ParserCombinators.Parsec.Pos
diff --git a/src/Text/ParserCombinators/Parsec/Prim.hs b/src/Text/ParserCombinators/Parsec/Prim.hs
index 21a271799cb386c804ce89ed3652e4a894c353cb..e2a9fb934c689cbf13e91625a38b249f372768e7 100644
--- a/src/Text/ParserCombinators/Parsec/Prim.hs
+++ b/src/Text/ParserCombinators/Parsec/Prim.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE Safe #-}
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.ParserCombinators.Parsec.Prim
diff --git a/src/Text/ParserCombinators/Parsec/Token.hs b/src/Text/ParserCombinators/Parsec/Token.hs
index a8cce125c254ab6ce259d3c9c08138501c60ea93..6381c5eef4c64a63f513bae1714e6124aff267cb 100644
--- a/src/Text/ParserCombinators/Parsec/Token.hs
+++ b/src/Text/ParserCombinators/Parsec/Token.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE Safe #-}
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.ParserCombinators.Parsec.Token