on develop help sign in
Miscellaneous tweaks due to updating aeson and other dependencies
commit3f8bd78b0f6253ace56b00e93b2c17cf1c361ab8 authorBrendan Hay <brendan.g.hay@gmail.com> dateSat 11 Feb 2017, 11:03 (10 years ago) parent9761143
7 files changed+43−11
gen/.ghci+3 gen/gogol-gen.cabal+1 gen/src/Gen/Orphans.hs+23 gen/src/Gen/Types/Data.hs−1 gen/src/Gen/Types/Id.hs+15−8 gen/src/Gen/Types/Schema.hs−1 gen/src/Main.hs+1−1
gen/.ghcinew file+3
@@ -0,0 +1,3 @@
1+:set -XOverloadedStrings
2+
3+:set prompt "> "
gen/gogol-gen.cabal+1
@@ -28,6 +28,7 @@ executable gogol-gen
2828 , Gen.Formatting
2929 , Gen.IO
3030 , Gen.JSON
31+ , Gen.Orphans
3132 , Gen.Syntax
3233 , Gen.TH
3334 , Gen.Text
gen/src/Gen/Orphans.hsnew file+23
@@ -0,0 +1,23 @@
1+{-# LANGUAGE FlexibleInstances #-}
2+
3+{-# OPTIONS_GHC -fno-warn-orphans #-}
4+
5+-- Module : Gen.Orphans
6+-- Copyright : (c) 2015-2016 Brendan Hay
7+-- License : Mozilla Public License, v. 2.0.
8+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
9+-- Stability : provisional
10+-- Portability : non-portable (GHC extensions)
11+
12+module Gen.Orphans where
13+
14+import Data.Hashable
15+import Data.String
16+import Language.Haskell.Exts.Build
17+import Language.Haskell.Exts.Syntax
18+
19+instance Hashable Name
20+
21+instance IsString Name where fromString = name
22+instance IsString QName where fromString = UnQual . name
23+instance IsString QOp where fromString = op . sym
gen/src/Gen/Types/Data.hs−1
@@ -31,7 +31,6 @@ import Data.Text (Text)
3131import qualified Data.Text as Text
3232import qualified Data.Text.Lazy as LText
3333import Data.Text.Manipulate
34−import Gen.Orphans ()
3534import Gen.Types.Help
3635import Gen.Types.Id
3736import Gen.Types.NS
gen/src/Gen/Types/Id.hs+15−8
@@ -71,7 +71,6 @@ import qualified Data.Text as Text
7171import qualified Data.Text.Lazy.Builder as Build
7272import Data.Text.Manipulate
7373import Formatting
74−import Gen.Orphans ()
7574import Gen.Text
7675import GHC.Generics (Generic)
7776import Language.Haskell.Exts.Build
@@ -161,20 +160,28 @@ instance IsString Global where
161160instance FromJSON Global where
162161 parseJSON = withText "global" (pure . mkGlobal)
163162
163+instance FromJSONKey Global where
164+ fromJSONKey = FromJSONKeyText mkGlobal
165+
164166instance ToJSON Global where
165167 toJSON = toJSON . global
166168
167−instance FromJSONKey Global
168−instance ToJSONKey Global
169−
170169gid :: Format a (Global -> a)
171170gid = later (Build.fromText . global)
172171
173172newtype Local = Local { local :: Text }
174− deriving (Eq, Ord, Show, Generic, Hashable, FromJSON, ToJSON, IsString)
175−
176−instance FromJSONKey Local
177−instance ToJSONKey Local
173+ deriving
174+ ( Eq
175+ , Ord
176+ , Show
177+ , Generic
178+ , Hashable
179+ , FromJSON
180+ , ToJSON
181+ , FromJSONKey
182+ , ToJSONKey
183+ , IsString
184+ )
178185
179186lid :: Format a (Local -> a)
180187lid = later (Build.fromText . local)
gen/src/Gen/Types/Schema.hs−1
@@ -38,7 +38,6 @@ import Data.Semigroup ((<>))
3838import Data.Text (Text)
3939import qualified Data.Text as Text
4040import Data.Text.Manipulate
41−import Gen.Orphans ()
4241import Gen.Text
4342import Gen.TH
4443import Gen.Types.Help
gen/src/Main.hs+1−1
@@ -153,7 +153,7 @@ main = do
153153 let anx = _optAnnexes </> fromText modelName <.> "json"
154154 p <- isFile anx
155155 if not p
156− then say ("Skipping '" % stext % "' due to mimsing annex configuration.")
156+ then say ("Skipping '" % stext % "' due to missing annex configuration.")
157157 modelName
158158 else do
159159 s <- sequence