on develop help sign in
Fixing compiler warnings
f3a8118Brendan Hay
gen/src/Gen/AST.hs−1
@@ -9,7 +9,6 @@ module Gen.AST where
9
9
10import Control.Monad.Except
10import Control.Monad.Except
11import Control.Monad.State.Strict
11import Control.Monad.State.Strict
12−import Debug.Trace
13import Gen.AST.Flatten (flatten)
12import Gen.AST.Flatten (flatten)
14import Gen.AST.Render (render)
13import Gen.AST.Render (render)
15import Gen.AST.Solve (solve)
14import Gen.AST.Solve (solve)
gen/src/Gen/AST/Render.hs+3−7
@@ -25,17 +25,13 @@ module Gen.AST.Render
25import Control.Applicative
25import Control.Applicative
26import Control.Error
26import Control.Error
27import Control.Lens hiding (enum, lens)
27import Control.Lens hiding (enum, lens)
28−import Control.Monad.Except
29import Data.Char (isSpace)
28import Data.Char (isSpace)
30import qualified Data.HashMap.Strict as Map
29import qualified Data.HashMap.Strict as Map
31import Data.Maybe
30import Data.Maybe
32import Data.Semigroup ((<>))
31import Data.Semigroup ((<>))
33import Data.String
32import Data.String
34−import qualified Data.Text as Text
35import qualified Data.Text.Lazy as LText
33import qualified Data.Text.Lazy as LText
36import qualified Data.Text.Lazy.Builder as Build
34import qualified Data.Text.Lazy.Builder as Build
37−import Data.Text.Manipulate
38−import Debug.Trace
39import Gen.AST.Solve (getSolved)
35import Gen.AST.Solve (getSolved)
40import Gen.Formatting
36import Gen.Formatting
41import Gen.Syntax
37import Gen.Syntax
@@ -74,9 +70,9 @@ renderSchema s = go (_schema s)
74
70
75 object i (Obj aps ps) = do
71 object i (Obj aps ps) = do
76 a <- traverse getSolved aps
72 a <- traverse getSolved aps
77− p <- traverse getSolved ps
73+ b <- traverse getSolved ps
78− let ap = setAdditional <$> a
74+ let ab = setAdditional <$> a
79− ts = maybe p (flip (Map.insert "addtional") p) ap
75+ ts = maybe b (flip (Map.insert "addtional") b) ab
80 prod ts
76 prod ts
81 where
77 where
82 prod ts = Prod (dname k) (i ^. iDescription)
78 prod ts = Prod (dname k) (i ^. iDescription)
gen/src/Gen/AST/Solve.hs−1
@@ -39,7 +39,6 @@ import Data.Semigroup ((<>))
39import Data.Text (Text)
39import Data.Text (Text)
40import qualified Data.Text as Text
40import qualified Data.Text as Text
41import Data.Text.Manipulate
41import Data.Text.Manipulate
42−import Debug.Trace
43import Gen.Formatting
42import Gen.Formatting
44import Gen.Text
43import Gen.Text
45import Gen.Types
44import Gen.Types
gen/src/Gen/Types/Id.hs+4−4
@@ -228,17 +228,17 @@ extractPath x = either (error . err) id $ A.parseOnly path x
228 <*> optional (A.char ':' *> A.takeWhile1 (A.notInClass "/{+*}:"))
228 <*> optional (A.char ':' *> A.takeWhile1 (A.notInClass "/{+*}:"))
229
229
230orderParams :: (a -> Local) -> [a] -> [Local] -> [a]
230orderParams :: (a -> Local) -> [a] -> [Local] -> [a]
231−orderParams f xs ys = orderBy f zs (del zs [] ++ global)
231+orderParams f xs ys = orderBy f zs (del zs [] ++ reserve)
232 where
232 where
233 zs = orderBy f (sortOn f xs) (nub (ys ++ map f xs))
233 zs = orderBy f (sortOn f xs) (nub (ys ++ map f xs))
234
234
235 del _ [] = []
235 del _ [] = []
236 del [] rs = reverse rs
236 del [] rs = reverse rs
237 del (r:qs) rs
237 del (r:qs) rs
238− | f r `elem` global = del qs rs
238+ | f r `elem` reserve = del qs rs
239− | otherwise = del qs (f r:rs)
239+ | otherwise = del qs (f r:rs)
240
240
241− global =
241+ reserve =
242 [ "quotaUser"
242 [ "quotaUser"
243 , "prettyPrint"
243 , "prettyPrint"
244 , "userIp"
244 , "userIp"
gen/src/Gen/Types/Map.hs−5
@@ -14,9 +14,7 @@
14module Gen.Types.Map where
14module Gen.Types.Map where
15
15
16import Control.Lens
16import Control.Lens
17−import Control.Monad
18import Data.Aeson
17import Data.Aeson
19−import Data.Aeson.Types
20import Data.Bifunctor
18import Data.Bifunctor
21import Data.Hashable
19import Data.Hashable
22import qualified Data.HashMap.Strict as Map
20import qualified Data.HashMap.Strict as Map
@@ -44,6 +42,3 @@ class (Hashable a, Eq a) => TextKey a where
44instance (TextKey k, FromJSON v) => FromJSON (Map k v) where
42instance (TextKey k, FromJSON v) => FromJSON (Map k v) where
45 parseJSON = fmap (Map.fromList . map (first toKey) . Map.toList)
43 parseJSON = fmap (Map.fromList . map (first toKey) . Map.toList)
46 . parseJSON
44 . parseJSON
47−
48−-- instance (TextKey k, ToJSON v) => ToJSON (Map k v) where
49−-- toJSON = toJSON . map (first fromKey) . Map.toList