From e21b57991e589d88f50991b87c6ec01d350e9b22 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 16 Mar 2018 10:08:38 -0700 Subject: Added custom prelude. We need this again because of Monoid/Semigroup. --- prelude/Prelude.hs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 prelude/Prelude.hs (limited to 'prelude') diff --git a/prelude/Prelude.hs b/prelude/Prelude.hs new file mode 100644 index 000000000..68e1b30f7 --- /dev/null +++ b/prelude/Prelude.hs @@ -0,0 +1,22 @@ +{-# LANGUAGE PackageImports #-} +{-# LANGUAGE CPP #-} + +module Prelude +( + module P +, Monoid(..) +, Semigroup(..) +, Applicative(..) +#if MIN_VERSION_base(4,9,0) +-- <> is exported in Semigroup +#else +, (<>) +#endif +) +where + +import "base" Prelude as P +import Data.Semigroup (Semigroup(..)) -- includes (<>) +#if MIN_VERSION_base(4,11,0) +import Data.Monoid (Monoid(..)) +#endif -- cgit v1.2.3 From d0c27989a6d16b2bb5a3490041d5c660be8653d4 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 16 Mar 2018 12:28:52 -0700 Subject: Fix Prelude <> export. --- prelude/Prelude.hs | 5 ----- 1 file changed, 5 deletions(-) (limited to 'prelude') diff --git a/prelude/Prelude.hs b/prelude/Prelude.hs index 68e1b30f7..9c8ac9363 100644 --- a/prelude/Prelude.hs +++ b/prelude/Prelude.hs @@ -7,11 +7,6 @@ module Prelude , Monoid(..) , Semigroup(..) , Applicative(..) -#if MIN_VERSION_base(4,9,0) --- <> is exported in Semigroup -#else -, (<>) -#endif ) where -- cgit v1.2.3 From dd53545154c5149dc720cc34c9990b92aec78c1a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 18 Mar 2018 09:20:21 -0700 Subject: New approach to custom Prelude. We use no custom Prelude with the latest ghc version (8.4.1), so we don't have problems with ghci. See https://ghc.haskell.org/trac/ghc/ticket/10920 https://www.reddit.com/r/haskell/comments/3ryf2p/how_can_you_use_a_custom_prelude_with_ghci/ This may help with #4464. --- pandoc.cabal | 38 +++++++++++++++++++++++++++++++------- prelude/Prelude.hs | 14 +++++++------- 2 files changed, 38 insertions(+), 14 deletions(-) (limited to 'prelude') diff --git a/pandoc.cabal b/pandoc.cabal index c190effcb..7fd08662c 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -11,7 +11,7 @@ bug-reports: https://github.com/jgm/pandoc/issues stability: alpha homepage: https://pandoc.org category: Text -tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2 +tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.1 synopsis: Conversion between markup formats description: Pandoc is a Haskell library for converting from one markup format to another, and a command-line tool that uses @@ -398,8 +398,12 @@ library http-client-tls >= 0.2.4 && < 0.4, http-types >= 0.8 && < 0.13, case-insensitive >= 1.2 && < 1.3 - if !impl(ghc >= 8.0) + if impl(ghc < 8.0) build-depends: semigroups == 0.18.* + if impl(ghc < 8.4) + hs-source-dirs: prelude + other-modules: Prelude + build-depends: base-compat >= 0.9 if os(windows) cpp-options: -D_WINDOWS else @@ -563,8 +567,12 @@ library executable pandoc build-depends: pandoc, base >= 4.7 && < 5 - if !impl(ghc >= 8.0) + if impl(ghc < 8.0) build-depends: semigroups == 0.18.* + if impl(ghc < 8.4) + hs-source-dirs: prelude + other-modules: Prelude + build-depends: base-compat >= 0.9 ghc-options: -rtsopts -with-rtsopts=-K16m -Wall -fno-warn-unused-do-bind -threaded if flag(static) ld-options: -static @@ -590,8 +598,12 @@ executable trypandoc buildable: True else buildable: False - if !impl(ghc >= 8.0) + if impl(ghc < 8.0) build-depends: semigroups == 0.18.* + if impl(ghc < 8.4) + hs-source-dirs: prelude + other-modules: Prelude + build-depends: base-compat >= 0.9 executable weigh-pandoc main-is: weigh-pandoc.hs @@ -606,8 +618,12 @@ executable weigh-pandoc buildable: True else buildable: False - if !impl(ghc >= 8.0) + if impl(ghc < 8.0) build-depends: semigroups == 0.18.* + if impl(ghc < 8.4) + hs-source-dirs: prelude + other-modules: Prelude + build-depends: base-compat >= 0.9 ghc-options: -rtsopts -Wall -fno-warn-unused-do-bind default-language: Haskell98 @@ -638,8 +654,12 @@ test-suite test-pandoc zip-archive >= 0.2.3.4 && < 0.4, xml >= 1.3.12 && < 1.4, Glob >= 0.7 && < 0.10 - if !impl(ghc >= 8.0) + if impl(ghc < 8.0) build-depends: semigroups == 0.18.* + if impl(ghc < 8.4) + hs-source-dirs: prelude + other-modules: Prelude + build-depends: base-compat >= 0.9 if flag(old-locale) build-depends: old-locale >= 1 && < 1.1, time >= 1.2 && < 1.5 @@ -706,7 +726,11 @@ benchmark benchmark-pandoc base >= 4.2 && < 5, text >= 0.11 && < 1.3, criterion >= 1.0 && < 1.5 - if !impl(ghc >= 8.0) + if impl(ghc < 8.0) build-depends: semigroups == 0.18.* + if impl(ghc < 8.4) + hs-source-dirs: prelude + other-modules: Prelude + build-depends: base-compat >= 0.9 ghc-options: -rtsopts -Wall -fno-warn-unused-do-bind default-language: Haskell98 diff --git a/prelude/Prelude.hs b/prelude/Prelude.hs index 9c8ac9363..5ea523433 100644 --- a/prelude/Prelude.hs +++ b/prelude/Prelude.hs @@ -1,17 +1,17 @@ +{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE PackageImports #-} {-# LANGUAGE CPP #-} +-- The intent is that this Prelude provide the API of +-- the base 4.11 Prelude in a way that is portable for +-- all base versions. + module Prelude ( - module P -, Monoid(..) + module Prelude.Compat , Semigroup(..) -, Applicative(..) ) where -import "base" Prelude as P +import Prelude.Compat import Data.Semigroup (Semigroup(..)) -- includes (<>) -#if MIN_VERSION_base(4,11,0) -import Data.Monoid (Monoid(..)) -#endif -- cgit v1.2.3