From e21b57991e589d88f50991b87c6ec01d350e9b22 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 16 Mar 2018 10:08:38 -0700 Subject: [PATCH] Added custom prelude. We need this again because of Monoid/Semigroup. --- pandoc.cabal | 24 ++++++++++++++++-------- prelude/Prelude.hs | 22 ++++++++++++++++++++++ 2 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 prelude/Prelude.hs diff --git a/pandoc.cabal b/pandoc.cabal index 5d3948d21..8989bd133 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -398,6 +398,8 @@ 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) + build-depends: semigroups == 0.18.* if os(windows) cpp-options: -D_WINDOWS else @@ -423,7 +425,7 @@ library ScopedTypeVariables, GeneralizedNewtypeDeriving, RelaxedPolyRec, DeriveDataTypeable, TypeSynonymInstances, FlexibleInstances - hs-source-dirs: src + hs-source-dirs: src, prelude exposed-modules: Text.Pandoc, Text.Pandoc.App, @@ -508,7 +510,8 @@ library Text.Pandoc.ImageSize, Text.Pandoc.BCP47, Text.Pandoc.Class - other-modules: Text.Pandoc.Filter, + other-modules: Prelude, + Text.Pandoc.Filter, Text.Pandoc.Filter.JSON, Text.Pandoc.Filter.Lua, Text.Pandoc.Filter.Path, @@ -568,14 +571,16 @@ executable pandoc ScopedTypeVariables, GeneralizedNewtypeDeriving, RelaxedPolyRec, DeriveDataTypeable, TypeSynonymInstances, FlexibleInstances - hs-source-dirs: . + hs-source-dirs: ., prelude main-is: pandoc.hs buildable: True other-modules: Paths_pandoc + Prelude executable trypandoc main-is: trypandoc.hs - hs-source-dirs: trypandoc + hs-source-dirs: trypandoc, prelude + other-modules: Prelude default-language: Haskell2010 if flag(trypandoc) build-depends: base, aeson, pandoc, @@ -586,7 +591,8 @@ executable trypandoc executable weigh-pandoc main-is: weigh-pandoc.hs - hs-source-dirs: benchmark + hs-source-dirs: benchmark, prelude + other-modules: Prelude if flag(weigh-pandoc) build-depends: pandoc, base >= 4.2 && < 5, @@ -602,7 +608,7 @@ executable weigh-pandoc test-suite test-pandoc type: exitcode-stdio-1.0 main-is: test-pandoc.hs - hs-source-dirs: test + hs-source-dirs: test, prelude build-depends: base >= 4.2 && < 5, pandoc, pandoc-types >= 1.17.4 && < 1.18, @@ -631,7 +637,8 @@ test-suite test-pandoc time >= 1.2 && < 1.5 else build-depends: time >= 1.5 && < 1.10 - other-modules: Tests.Old + other-modules: Prelude + Tests.Old Tests.Command Tests.Helpers Tests.Lua @@ -684,7 +691,8 @@ test-suite test-pandoc benchmark benchmark-pandoc type: exitcode-stdio-1.0 main-is: benchmark-pandoc.hs - hs-source-dirs: benchmark + hs-source-dirs: benchmark, prelude + other-modules: Prelude build-depends: pandoc, time, bytestring, containers, base >= 4.2 && < 5, 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