Skip to content

Commit 42c6cb7

Browse files
author
Reto Kühni
committed
higherkindness#257 code cleanup
1 parent 1f306df commit 42c6cb7

File tree

4 files changed

+22
-21
lines changed

4 files changed

+22
-21
lines changed

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"[haskell]": {
33
"editor.formatOnSave": true,
4-
"editor.defaultFormatter": "haskell.haskell"
4+
"editor.defaultFormatter": "vigoo.stylish-haskell"
55
},
66
"haskell.formattingProvider": "stylish-haskell"
77
}

adapter/protobuf/src/Mu/Quasi/GRpc.hs

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ import Mu.Rpc
3131
grpc :: String -> (String -> String) -> FilePath -> Q [Dec]
3232
grpc schemaName servicePrefix fp
3333
= do r <- liftIO $ parseProtoBufFile fp
34-
case r of
35-
Left e
36-
-> fail ("could not parse protocol buffers spec: " ++ show e)
37-
Right p
38-
-> grpcToDecls schemaName servicePrefix p =<< loadImports fp p
34+
case r of
35+
Left e
36+
-> fail ("could not parse protocol buffers spec: " ++ show e)
37+
Right p
38+
-> grpcToDecls schemaName servicePrefix p =<< loadImports fp p
3939

4040
grpcToDecls :: String -> (String -> String) -> P.ProtoBuf -> [P.ProtoBuf] -> Q [Dec]
4141
grpcToDecls schemaName servicePrefix p@P.ProtoBuf { P.package = pkg, P.services = srvs } imps

adapter/protobuf/src/Mu/Quasi/ProtoBuf.hs

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@ module Mu.Quasi.ProtoBuf (
1717
protobuf
1818
-- * Only for internal use
1919
, protobufToDecls
20+
, loadImports
2021
) where
2122

22-
import Control.Monad (when, foldM)
23+
import Control.Monad (foldM, when)
2324
import Control.Monad.IO.Class
2425
import qualified Data.ByteString as B
2526
import Data.Int
2627
import qualified Data.List as L
27-
import qualified Data.Map.Strict as M
28-
import Data.Maybe (maybe)
2928
import Data.List.NonEmpty (NonEmpty (..), toList)
29+
import qualified Data.Map.Strict as M
3030
import qualified Data.Text as T
3131
import Data.Word
3232
import Language.Haskell.TH
3333
import Language.ProtocolBuffers.Parser
3434
import qualified Language.ProtocolBuffers.Types as P
35-
import System.FilePath (takeDirectory, (</>))
35+
import System.FilePath (takeDirectory, (</>))
3636

3737
import Mu.Adapter.ProtoBuf
3838
import Mu.Schema.Annotations
@@ -133,8 +133,8 @@ flattenDecls (currentScope :| higherScopes) = concatMap flattenDecl
133133
then [qualifyName scopeName ts]
134134
else qualifyTOther rest ts
135135
where
136-
qualifyName "" ts = T.intercalate "." ts
137-
qualifyName scopeName ts = qualifyName "" (scopeName:ts)
136+
qualifyName "" ts' = T.intercalate "." ts'
137+
qualifyName sn ts'=qualifyName "" (sn:ts')
138138

139139
hasDeclFor [] _ = True
140140
hasDeclFor [t] (P.DEnum enumName _ _) = t == enumName

stack.yaml

+10-9
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ allow-newer: true
33

44
packages:
55
- adapter/avro
6-
- adapter/kafka
6+
#- adapter/kafka
77
- adapter/persistent
88
- adapter/protobuf
99
- core/lens
1010
- core/optics
1111
- core/rpc
1212
- core/schema
13-
- examples/health-check
14-
- examples/library/backend
15-
- examples/route-guide
16-
- examples/seed
17-
- examples/todolist
18-
- examples/with-persistent
19-
- graphql
13+
#- examples/health-check
14+
#- examples/library/backend
15+
#- examples/route-guide
16+
#- examples/seed
17+
#- examples/todolist
18+
#- examples/with-persistent
19+
#- graphql
2020
- grpc/client
2121
- grpc/common
2222
- grpc/server
@@ -32,9 +32,10 @@ extra-deps:
3232
- http2-grpc-proto3-wire-0.1.0.0
3333
- http2-grpc-types-0.5.0.0
3434
- warp-grpc-0.4.0.1
35-
- hw-kafka-conduit-2.7.0
35+
#- hw-kafka-conduit-2.7.0
3636
- graphql-1.0.3.0
3737
- stm-hamt-1.2.0.7
3838
- stm-containers-1.2
3939
- tracing-0.0.7.2
4040
- tracing-control-0.0.7.3
41+
#- unix-2.8.5.0@sha256:633f15ef0bd50a16a7b5c5e86e6659fee6e4e211e098cc8bd0029f452bfcfddc,9808

0 commit comments

Comments
 (0)