Skip to content

Commit 885e22c

Browse files
committed
build with aeson 2.0
1 parent 1ba7598 commit 885e22c

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

puzzle-draw.cabal

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ library
6767
diagrams-lib >=1.4.2.3 && <1.5,
6868
parsec >=3.1,
6969
yaml >=0.8.4,
70-
aeson >=0.7,
70+
aeson >=2.0,
7171
unordered-containers >=0.2,
7272
containers >=0.5,
7373
hashable >=1.2,
@@ -97,7 +97,7 @@ executable drawpuzzle
9797
diagrams-lib >=1.4.2.3 && <1.5,
9898
yaml >=0.8.4,
9999
optparse-applicative >=0.12,
100-
aeson >=0.7,
100+
aeson >=2.0,
101101
filepath >=1.3,
102102
bytestring >=0.10,
103103
diagrams-rasterific >=1.4.2,
@@ -113,7 +113,7 @@ executable checkpuzzle
113113
yaml >=0.8.4,
114114
containers >=0.5,
115115
optparse-applicative >=0.12,
116-
aeson >=0.7,
116+
aeson >=2.0,
117117
bytestring >=0.10,
118118
filepath >=1.3
119119

@@ -128,7 +128,7 @@ executable servepuzzle
128128
snap-core >=0.9,
129129
snap-server >=0.9,
130130
diagrams-lib >=1.2,
131-
aeson >=0.7,
131+
aeson >=2.0,
132132
yaml >=0.8.4,
133133
filepath >=1.3,
134134
directory >=1.2,

src/Parse/Util.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,19 @@ import Data.Ord (comparing)
3232
import qualified Data.Text as T
3333
import Data.Traversable (mapM)
3434
import Data.Yaml
35+
import qualified Data.Aeson.Key
3536
import Parse.Parsec
3637
import Text.Read (readMaybe)
3738
import Prelude hiding (mapM)
3839

3940
type Path = [String]
4041

4142
field :: Path -> Value -> Parser Value
42-
field = field' . map T.pack
43+
field = field' . map (Data.Aeson.Key.fromText . T.pack)
4344
where
4445
field' [] v = pure v
4546
field' (f : fs) (Object v) = v .: f >>= field' fs
46-
field' (f : _) _ = fail $ "expected field '" ++ T.unpack f ++ "'"
47+
field' (f : _) _ = fail $ "expected field '" ++ (T.unpack . Data.Aeson.Key.toText $ f) ++ "'"
4748

4849
parseFrom :: Path -> (Value -> Parser b) -> Value -> Parser b
4950
parseFrom fs p v =

0 commit comments

Comments
 (0)