From b532a967e06f644d93af9afe732cfdc3120dc327 Mon Sep 17 00:00:00 2001 From: Jens Petersen Date: Thu, 19 Mar 2020 18:53:13 +0800 Subject: [PATCH] allow building with modern ghc versions - allow parsec3 - drop old-locale - stack init for lts-9 (which still had readline) --- husky.cabal | 16 ++++++++++++++-- src/InfoRoutines.hs | 1 - src/TokenParser.hs | 5 +++++ src/UnitConverter.hs | 2 +- stack.yaml | 1 + 5 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 stack.yaml diff --git a/husky.cabal b/husky.cabal index 0f10a6e..79e0db6 100644 --- a/husky.cabal +++ b/husky.cabal @@ -18,8 +18,20 @@ extra-source-files: README Executable husky Build-Depends: base, readline >= 1.0.1.0, containers >= 0.1.0.0, - parsec == 2.1.*, mtl >= 1.1.0.0, - old-locale >= 1.0.0.0, time >= 1.0.0.0 + parsec, mtl >= 1.1.0.0, + time >= 1.0.0.0 ghc-options: -O2 Main-Is: husky.hs hs-source-dirs: src + other-modules: CalculatorParser + CalculatorState + ErrorParser + ExtraFunctions + HelpParser + InfoRoutines + Messages + Parser + PrettyPrint + TokenParser + UnitConversionParser + UnitConverter diff --git a/src/InfoRoutines.hs b/src/InfoRoutines.hs index e63d1e3..4068090 100644 --- a/src/InfoRoutines.hs +++ b/src/InfoRoutines.hs @@ -34,7 +34,6 @@ import Data.Map import Data.Time import Prelude import System.IO -import System.Locale -- local imports diff --git a/src/TokenParser.hs b/src/TokenParser.hs index 79f844e..38970f9 100644 --- a/src/TokenParser.hs +++ b/src/TokenParser.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE CPP #-} + {----------------------------------------------------------------- (c) 2008-2009 Markus Dittrich @@ -61,6 +63,8 @@ import ExtraFunctions +#if (defined(MIN_VERSION_parsec) && MIN_VERSION_parsec(3,0,0)) +#else {- Definitions for Applicative Parsec instance -} -- | Applicative instance for Monad @@ -73,6 +77,7 @@ instance Applicative (GenParser s a) where instance Alternative (GenParser s a) where empty = mzero (<|>) = mplus +#endif diff --git a/src/UnitConverter.hs b/src/UnitConverter.hs index 0c78b15..d4f6efd 100644 --- a/src/UnitConverter.hs +++ b/src/UnitConverter.hs @@ -78,7 +78,7 @@ convert_unit value unit1 unit2 unitType = -- | helper function looking through all unit maps for a matching -- conversion routine unit_lookup :: String -> M.Map String UnitMap -> [UnitConverter] -unit_lookup key = M.fold append_val [] +unit_lookup key = M.foldr append_val [] where append_val entry acc = case M.lookup key entry of Nothing -> acc diff --git a/stack.yaml b/stack.yaml new file mode 100644 index 0000000..7667535 --- /dev/null +++ b/stack.yaml @@ -0,0 +1 @@ +resolver: lts-9.21