Skip to content

Commit

Permalink
higherkindness#257 code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Reto Kühni committed Feb 3, 2024
1 parent 1f306df commit 42c6cb7
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"[haskell]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "haskell.haskell"
"editor.defaultFormatter": "vigoo.stylish-haskell"
},
"haskell.formattingProvider": "stylish-haskell"
}
10 changes: 5 additions & 5 deletions adapter/protobuf/src/Mu/Quasi/GRpc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ import Mu.Rpc
grpc :: String -> (String -> String) -> FilePath -> Q [Dec]
grpc schemaName servicePrefix fp
= do r <- liftIO $ parseProtoBufFile fp
case r of
Left e
-> fail ("could not parse protocol buffers spec: " ++ show e)
Right p
-> grpcToDecls schemaName servicePrefix p =<< loadImports fp p
case r of
Left e
-> fail ("could not parse protocol buffers spec: " ++ show e)
Right p
-> grpcToDecls schemaName servicePrefix p =<< loadImports fp p

grpcToDecls :: String -> (String -> String) -> P.ProtoBuf -> [P.ProtoBuf] -> Q [Dec]
grpcToDecls schemaName servicePrefix p@P.ProtoBuf { P.package = pkg, P.services = srvs } imps
Expand Down
12 changes: 6 additions & 6 deletions adapter/protobuf/src/Mu/Quasi/ProtoBuf.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ module Mu.Quasi.ProtoBuf (
protobuf
-- * Only for internal use
, protobufToDecls
, loadImports
) where

import Control.Monad (when, foldM)
import Control.Monad (foldM, when)
import Control.Monad.IO.Class
import qualified Data.ByteString as B
import Data.Int
import qualified Data.List as L
import qualified Data.Map.Strict as M
import Data.Maybe (maybe)
import Data.List.NonEmpty (NonEmpty (..), toList)
import qualified Data.Map.Strict as M
import qualified Data.Text as T
import Data.Word
import Language.Haskell.TH
import Language.ProtocolBuffers.Parser
import qualified Language.ProtocolBuffers.Types as P
import System.FilePath (takeDirectory, (</>))
import System.FilePath (takeDirectory, (</>))

import Mu.Adapter.ProtoBuf
import Mu.Schema.Annotations
Expand Down Expand Up @@ -133,8 +133,8 @@ flattenDecls (currentScope :| higherScopes) = concatMap flattenDecl
then [qualifyName scopeName ts]
else qualifyTOther rest ts
where
qualifyName "" ts = T.intercalate "." ts
qualifyName scopeName ts = qualifyName "" (scopeName:ts)
qualifyName "" ts' = T.intercalate "." ts'
qualifyName sn ts'=qualifyName "" (sn:ts')

hasDeclFor [] _ = True
hasDeclFor [t] (P.DEnum enumName _ _) = t == enumName
Expand Down
19 changes: 10 additions & 9 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ allow-newer: true

packages:
- adapter/avro
- adapter/kafka
#- adapter/kafka
- adapter/persistent
- adapter/protobuf
- core/lens
- core/optics
- core/rpc
- core/schema
- examples/health-check
- examples/library/backend
- examples/route-guide
- examples/seed
- examples/todolist
- examples/with-persistent
- graphql
#- examples/health-check
#- examples/library/backend
#- examples/route-guide
#- examples/seed
#- examples/todolist
#- examples/with-persistent
#- graphql
- grpc/client
- grpc/common
- grpc/server
Expand All @@ -32,9 +32,10 @@ extra-deps:
- http2-grpc-proto3-wire-0.1.0.0
- http2-grpc-types-0.5.0.0
- warp-grpc-0.4.0.1
- hw-kafka-conduit-2.7.0
#- hw-kafka-conduit-2.7.0
- graphql-1.0.3.0
- stm-hamt-1.2.0.7
- stm-containers-1.2
- tracing-0.0.7.2
- tracing-control-0.0.7.3
#- unix-2.8.5.0@sha256:633f15ef0bd50a16a7b5c5e86e6659fee6e4e211e098cc8bd0029f452bfcfddc,9808

0 comments on commit 42c6cb7

Please sign in to comment.