Skip to content

Commit

Permalink
Add intentional support for SafeHaskell
Browse files Browse the repository at this point in the history
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.

Support for GHC 7.0, GHC 7.2, and GHC 7.4.1 has been dropped,
consequently the support window starts with GHC 7.4.2.

This addresses #88
  • Loading branch information
hvr committed Feb 5, 2018
1 parent d7c5d33 commit 00dd731
Show file tree
Hide file tree
Showing 28 changed files with 84 additions and 19 deletions.
6 changes: 0 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]}}
Expand Down
24 changes: 24 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
20 changes: 12 additions & 8 deletions parsec.cabal
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/Text/Parsec.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE Safe #-}

{-|
Module : Text.Parsec
Copyright : (c) Daan Leijen 1999-2001, (c) Paolo Martini 2007
Expand Down
2 changes: 2 additions & 0 deletions src/Text/Parsec/ByteString.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE Safe #-}

-----------------------------------------------------------------------------
-- |
-- Module : Text.Parsec.ByteString
Expand Down
4 changes: 3 additions & 1 deletion src/Text/Parsec/ByteString/Lazy.hs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Text/Parsec/Char.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{-# LANGUAGE CPP, FlexibleContexts #-}
{-# LANGUAGE CPP, FlexibleContexts, Safe #-}

-----------------------------------------------------------------------------
-- |
Expand Down
3 changes: 3 additions & 0 deletions src/Text/Parsec/Combinator.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
-- due to Debug.Trace
{-# LANGUAGE Trustworthy #-}

-----------------------------------------------------------------------------
-- |
-- Module : Text.Parsec.Combinator
Expand Down
1 change: 1 addition & 0 deletions src/Text/Parsec/Error.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE Safe #-}

-----------------------------------------------------------------------------
-- |
Expand Down
1 change: 1 addition & 0 deletions src/Text/Parsec/Expr.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE Safe #-}

-----------------------------------------------------------------------------
-- |
Expand Down
2 changes: 2 additions & 0 deletions src/Text/Parsec/Language.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE Safe #-}

-----------------------------------------------------------------------------
-- |
-- Module : Text.Parsec.Language
Expand Down
1 change: 1 addition & 0 deletions src/Text/Parsec/Perm.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE Safe #-}

-----------------------------------------------------------------------------
-- |
Expand Down
1 change: 1 addition & 0 deletions src/Text/Parsec/Pos.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE Safe #-}

-----------------------------------------------------------------------------
-- |
Expand Down
1 change: 1 addition & 0 deletions src/Text/Parsec/Prim.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PolymorphicComponents #-}
{-# LANGUAGE Safe #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE UndecidableInstances #-}

Expand Down
2 changes: 2 additions & 0 deletions src/Text/Parsec/String.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE Safe #-}

-----------------------------------------------------------------------------
-- |
-- Module : Text.Parsec.String
Expand Down
2 changes: 2 additions & 0 deletions src/Text/Parsec/Text.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE Safe #-}

-----------------------------------------------------------------------------
-- |
-- Module : Text.Parsec.String
Expand Down
2 changes: 2 additions & 0 deletions src/Text/Parsec/Text/Lazy.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE Safe #-}

-----------------------------------------------------------------------------
-- |
-- Module : Text.Parsec.String
Expand Down
1 change: 1 addition & 0 deletions src/Text/Parsec/Token.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE PolymorphicComponents #-}
{-# LANGUAGE Safe #-}

-----------------------------------------------------------------------------
-- |
Expand Down
8 changes: 5 additions & 3 deletions src/Text/ParserCombinators/Parsec.hs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/Text/ParserCombinators/Parsec/Char.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE Safe #-}

-----------------------------------------------------------------------------
-- |
-- Module : Text.ParserCombinators.Parsec.Char
Expand Down
2 changes: 2 additions & 0 deletions src/Text/ParserCombinators/Parsec/Combinator.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE Safe #-}

-----------------------------------------------------------------------------
-- |
-- Module : Text.ParserCombinators.Parsec.Combinator
Expand Down
2 changes: 2 additions & 0 deletions src/Text/ParserCombinators/Parsec/Error.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE Safe #-}

-----------------------------------------------------------------------------
-- |
-- Module : Text.ParserCombinators.Parsec.Error
Expand Down
2 changes: 2 additions & 0 deletions src/Text/ParserCombinators/Parsec/Expr.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE Safe #-}

-----------------------------------------------------------------------------
-- |
-- Module : Text.ParserCombinators.Parsec.Expr
Expand Down
2 changes: 2 additions & 0 deletions src/Text/ParserCombinators/Parsec/Language.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE Safe #-}

-----------------------------------------------------------------------------
-- |
-- Module : Text.ParserCombinators.Parsec.Language
Expand Down
2 changes: 2 additions & 0 deletions src/Text/ParserCombinators/Parsec/Perm.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE Safe #-}

-----------------------------------------------------------------------------
-- |
-- Module : Text.ParserCombinators.Parsec.Perm
Expand Down
2 changes: 2 additions & 0 deletions src/Text/ParserCombinators/Parsec/Pos.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE Safe #-}

-----------------------------------------------------------------------------
-- |
-- Module : Text.ParserCombinators.Parsec.Pos
Expand Down
2 changes: 2 additions & 0 deletions src/Text/ParserCombinators/Parsec/Prim.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE Safe #-}

-----------------------------------------------------------------------------
-- |
-- Module : Text.ParserCombinators.Parsec.Prim
Expand Down
2 changes: 2 additions & 0 deletions src/Text/ParserCombinators/Parsec/Token.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE Safe #-}

-----------------------------------------------------------------------------
-- |
-- Module : Text.ParserCombinators.Parsec.Token
Expand Down

0 comments on commit 00dd731

Please sign in to comment.