From d8f6e0b476797938f5c759146a2bbdc829ba1a84 Mon Sep 17 00:00:00 2001 From: Gabriel Gonzalez Date: Fri, 4 Sep 2020 12:04:30 -0700 Subject: [PATCH] Fix `Arithmetic` example (#107) The instructions for testing the `Arithmetic` example were out of date --- examples/tutorial/Arithmetic.hs | 5 +++-- examples/tutorial/TUTORIAL.md | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/tutorial/Arithmetic.hs b/examples/tutorial/Arithmetic.hs index 8892347..cc35925 100644 --- a/examples/tutorial/Arithmetic.hs +++ b/examples/tutorial/Arithmetic.hs @@ -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") diff --git a/examples/tutorial/TUTORIAL.md b/examples/tutorial/TUTORIAL.md index 2dd2d7e..45e9de6 100644 --- a/examples/tutorial/TUTORIAL.md +++ b/examples/tutorial/TUTORIAL.md @@ -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`.