Skip to content

Commit bdc4c67

Browse files
authored
upgrade(ghc): changes necessary for ghc 8.10 and 9.0 compatibility (#44)
* cabal: set default-language, silence warning * stack: bump to lts-18.10 (ghc 8.10.7) * stack: don't require nix by default * fix warnings, drop th-lift, require ghc 8.0+ * allow template-haskell 2.17.0.0, build with stackage nightly (ghc 9.0.1) * bump version to 0.7.0.7, draft changelog * don't bother version-controlling stack.yaml.lock
1 parent 4ad777b commit bdc4c67

File tree

8 files changed

+34
-45
lines changed

8 files changed

+34
-45
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ cabal.sandbox.config
2121
# extra
2222
tmp
2323
.stack-work
24+
stack.yaml.lock

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 0.7.0.7 (unreleased)
2+
3+
- update bounds, fix warnings, require ghc 8.0+
4+
15
### 0.7.0.6
26

37
- Fixes issue causing compilation error to happen with ghc-8.8.2 [#33][#34]

System/Console/Docopt/QQ/Instances.hs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
1-
{-# LANGUAGE TemplateHaskell #-}
1+
{-# LANGUAGE DeriveLift#-}
2+
{-# LANGUAGE StandaloneDeriving #-}
3+
{-# LANGUAGE FlexibleInstances #-}
4+
25
{-# OPTIONS_GHC -fno-warn-orphans #-}
36
{-# OPTIONS_HADDOCK hide, prune #-}
7+
48
module System.Console.Docopt.QQ.Instances where
59

610
import System.Console.Docopt.Types
7-
import Language.Haskell.TH.Lift
8-
9-
import qualified Data.Map as M
10-
11-
instance (Lift k, Lift v) => Lift (M.Map k v) where
12-
lift m = [| M.fromList assoc |]
13-
where assoc = M.toList m
11+
import Language.Haskell.TH.Syntax (Lift)
12+
import Data.Map.Internal (Map(..))
1413

15-
$(deriveLiftMany [ ''Option
16-
, ''Pattern
17-
, ''OptionInfo
18-
, ''Docopt
19-
])
14+
deriving instance Lift (Map Option OptionInfo)
15+
deriving instance Lift (Docopt)

System/Console/Docopt/Types.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
{-# LANGUAGE DeriveLift#-}
12
module System.Console.Docopt.Types
23
where
34

45
import Data.Char (isUpper)
56
import Data.List (nub)
67
import Data.Map (Map)
78
import qualified Data.Map as M
8-
9+
import Language.Haskell.TH.Syntax (Lift)
910

1011
-- * Usage expression Types
1112

@@ -17,7 +18,7 @@ data Pattern a = Sequence [Pattern a]
1718
| Optional (Pattern a)
1819
| Repeated (Pattern a)
1920
| Atom a
20-
deriving (Show, Eq)
21+
deriving (Show, Eq, Lift)
2122

2223
atoms :: Eq a => Pattern a -> [a]
2324
atoms (Sequence ps) = concatMap atoms ps
@@ -33,7 +34,7 @@ data Option = LongOption Name
3334
| Command Name
3435
| Argument Name
3536
| AnyOption
36-
deriving (Show, Eq, Ord)
37+
deriving (Show, Eq, Ord, Lift)
3738

3839
type OptPattern = Pattern Option
3940

@@ -57,7 +58,7 @@ data OptionInfo = OptionInfo
5758
, defaultVal :: Maybe String
5859
, expectsVal :: Bool
5960
, isRepeated :: Bool
60-
} deriving (Show, Eq)
61+
} deriving (Show, Eq, Lift)
6162

6263
fromSynList :: [Option] -> OptionInfo
6364
fromSynList opts = OptionInfo { synonyms = opts

System/Console/Docopt/UsageParse.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module System.Console.Docopt.UsageParse
44
import qualified Data.Map as M
55
import Data.Ord (comparing)
66
import GHC.Exts (Down(..))
7-
import Data.List (nub, sortBy, maximumBy, dropWhile, dropWhileEnd)
7+
import Data.List (nub, sortBy, maximumBy, dropWhileEnd)
88

99
import System.Console.Docopt.ParseUtils
1010
import System.Console.Docopt.Types

docopt.cabal

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: docopt
2-
version: 0.7.0.6
2+
version: 0.7.0.7
33
synopsis: A command-line interface parser that will make you smile
44
description: Docopt parses command-line interface usage text that adheres to a familiar syntax, and from it builds a command-line argument parser that will ensure your program is invoked correctly with the available options specified in the usage text. This allows the developer to write a usage text and get an argument parser for free.
55

@@ -57,8 +57,9 @@ library
5757
exposed-modules: System.Console.Docopt
5858
other-modules: System.Console.Docopt.QQ
5959
System.Console.Docopt.QQ.Instances
60-
build-depends: template-haskell >= 2.15.0 && < 2.16,
61-
th-lift >= 0.8.2 && < 0.9
60+
build-depends: template-haskell >= 2.15.0 && < 2.18
61+
62+
default-language: Haskell2010
6263

6364
test-suite tests
6465
type: exitcode-stdio-1.0
@@ -82,8 +83,8 @@ test-suite tests
8283
aeson,
8384
bytestring,
8485
text,
85-
template-haskell >= 2.15.0 && < 2.16,
86-
th-lift >= 0.8.2 && < 0.9
86+
template-haskell >= 2.15.0 && < 2.18
87+
8788

8889
other-modules: System.Console.Docopt
8990
System.Console.Docopt.ApplicativeParsec
@@ -95,3 +96,5 @@ test-suite tests
9596
System.Console.Docopt.QQ
9697
System.Console.Docopt.QQ.Instances
9798
Paths_docopt
99+
100+
default-language: Haskell2010

stack.yaml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
# For advanced use and comprehensive documentation of the format, please see:
22
# http://docs.haskellstack.org/en/stable/yaml_configuration/
33

4-
resolver: lts-16.20
4+
# ghc 8.10.7
5+
resolver: lts-18.10
6+
# ghc 9.0.1
7+
# resolver: nightly-2021-07-16
58

69
packages:
710
- '.'
811
- examples/
912

10-
# Uncomment to test https://github.com/docopt/docopt.hs/issues/29
11-
# extra-deps:
12-
# - aeson-1.0.2.0
13-
# flags:
14-
# aeson:
15-
# fast: true
16-
17-
nix:
18-
enable: true
13+
# nix:
14+
# enable: true

stack.yaml.lock

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)