Skip to content

Commit

Permalink
Point-release to address GHC 8.8.1 compat
Browse files Browse the repository at this point in the history
This constitutes a special GHC 8.8.1/base-4.13 only compatibility
release to support `MonadFail`

The next non-micro-pointrelease will support a wider compat window
again.

Addresses #8
  • Loading branch information
hvr committed Nov 9, 2019
1 parent 8ee8eea commit 26969a0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 21 deletions.
6 changes: 0 additions & 6 deletions Language/Haskell/ParseMonad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ instance App.Applicative ParseResult where
ParseFailed loc msg <*> _ = ParseFailed loc msg

instance Monad ParseResult where
return = pure
ParseOk x >>= f = f x
ParseFailed loc msg >>= _ = ParseFailed loc msg

Expand All @@ -63,7 +62,6 @@ instance Monoid m => Semi.Semigroup (ParseResult m) where

instance Monoid m => Monoid (ParseResult m) where
mempty = ParseOk mempty
mappend = (<>)

-- internal version
data ParseStatus a = Ok ParseState a | Failed SrcLoc String
Expand Down Expand Up @@ -129,12 +127,10 @@ instance Applicative P where
(<*>) = ap

instance Monad P where
return = pure
P m >>= k = P $ \i x y l s mode ->
case m i x y l s mode of
Failed loc msg -> Failed loc msg
Ok s' a -> runP (k a) i x y l s' mode
fail = Fail.fail

-- | @since 1.0.3.0
instance Fail.MonadFail P where
Expand Down Expand Up @@ -188,10 +184,8 @@ instance Applicative (Lex r) where
Lex v *> Lex w = Lex $ \k -> v (\_ -> w k)

instance Monad (Lex r) where
return = pure
Lex v >>= f = Lex $ \k -> v (\a -> runL (f a) k)
(>>) = (*>)
fail = Fail.fail

-- | @since 1.0.3.0
instance Fail.MonadFail (Lex r) where
Expand Down
2 changes: 0 additions & 2 deletions Language/Haskell/Pretty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ module Language.Haskell.Pretty

import Language.Haskell.Syntax

import Control.Applicative (Applicative (..))
import Control.Monad (ap)

import qualified Text.PrettyPrint as P
Expand Down Expand Up @@ -112,7 +111,6 @@ instance Applicative (DocM s) where
instance Monad (DocM s) where
(>>=) = thenDocM
(>>) = (*>)
return = pure

{-# INLINE thenDocM #-}
{-# INLINE then_DocM #-}
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 1.0.3.1

- GHC 8.8.1/base-4.13 only compatibility release to support `MonadFail`

## 1.0.3.0

- Add support for `MonadFail` & `Semigroup` proposals by
Expand Down
22 changes: 9 additions & 13 deletions haskell-src.cabal
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
cabal-version: >=1.10
cabal-version: 2.4
name: haskell-src
-- don't forget to update the changelog.md!
version: 1.0.3.0
build-type: Simple
version: 1.0.3.1

license: BSD3
license: BSD-3-Clause
license-file: LICENSE
author: Simon Marlow, Sven Panne and Noel Winstanley
-- Maintained through https://github.com/haskell-pkg-janitors. Join us!
Expand Down Expand Up @@ -36,17 +35,14 @@ library
Language.Haskell.Syntax,
Language.Haskell.ParseUtils

build-depends: base >= 4.3 && < 5
, syb >= 0.1 && < 0.8
, pretty >= 1.0.1.2 && < 1.2
, array >= 0.3 && < 0.6
build-depends: base ^>= 4.13.0.0
, syb ^>= 0.7
, pretty ^>= 1.1.3.6
, array ^>= 0.5.4.0

if !impl(ghc >= 8.0)
build-depends: semigroups == 0.18.*, fail == 4.9.*
else
ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances
ghc-options: -Wcompat -Wnoncanonical-monad-instances

build-tools: happy == 1.19.*
build-tool-depends: happy:happy == 1.19.*

default-language: Haskell98

Expand Down

0 comments on commit 26969a0

Please sign in to comment.