mirror of
https://github.com/unclechu/gRPC-haskell.git
synced 2024-11-22 19:19:42 +01:00
Fix Arithmetic
example (#107)
The instructions for testing the `Arithmetic` example were out of date
This commit is contained in:
parent
d7c3c3847a
commit
d8f6e0b476
2 changed files with 4 additions and 3 deletions
5
examples/tutorial/Arithmetic.hs
generated
5
examples/tutorial/Arithmetic.hs
generated
|
@ -9,6 +9,7 @@
|
|||
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
|
||||
|
||||
-- | Generated by Haskell protocol buffer compiler. DO NOT EDIT!
|
||||
|
||||
module Arithmetic where
|
||||
import qualified Prelude as Hs
|
||||
import qualified Proto3.Suite.Class as HsProtobuf
|
||||
|
@ -163,8 +164,8 @@ instance HsJSONPB.ToSchema TwoInts where
|
|||
HsJSONPB.insOrdFromList
|
||||
[("x", twoIntsX), ("y", twoIntsY)]}})
|
||||
|
||||
data OneInt = OneInt{oneIntResult :: Hs.Int32}
|
||||
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
|
||||
newtype OneInt = OneInt{oneIntResult :: Hs.Int32}
|
||||
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
|
||||
|
||||
instance HsProtobuf.Named OneInt where
|
||||
nameOf _ = (Hs.fromString "OneInt")
|
||||
|
|
|
@ -32,7 +32,7 @@ This library exposes quite a few modules, but you won't need to worry about most
|
|||
To start out, we need to generate code for our protocol buffers and RPCs. The `compile-proto-file` command is provided as part of `proto3-suite`. You can either use `stack install` in the `proto3-suite` repository to install the command globally, or use `stack exec` from within the `grpc-haskell` directory.
|
||||
|
||||
```
|
||||
$ stack exec -- compile-proto-file --proto examples/echo/echo.proto > examples/echo/echo-hs/Echo.hs
|
||||
$ stack exec -- compile-proto-file --includeDir examples/tutorial --proto arithmetic.proto --out examples/tutorial
|
||||
```
|
||||
|
||||
The `.proto` file compiler always names the generated module the same as the `.proto` file, capitalizing the first letter if it is not already. Since our proto file is `arithmetic.proto`, the generated code should be placed in `Arithmetic.hs`.
|
||||
|
|
Loading…
Reference in a new issue