You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which I've generated into the following haskell code with the compiler
...
{- | Fields :
* 'Proto.SoEvent_Fields.eventId' @:: Lens' SOAccountEvent Data.ByteString.ByteString@
* 'Proto.SoEvent_Fields.orderNumber' @:: Lens' SOAccountEvent Data.Word.Word64@
* 'Proto.SoEvent_Fields.accountNumber' @:: Lens' SOAccountEvent Data.Word.Word64@
* 'Proto.SoEvent_Fields.fromStatus' @:: Lens' SOAccountEvent SOStatus@
* 'Proto.SoEvent_Fields.toStatus' @:: Lens' SOAccountEvent SOStatus@
* 'Proto.SoEvent_Fields.targetStatus' @:: Lens' SOAccountEvent SOStatus@
* 'Proto.SoEvent_Fields.direction' @:: Lens' SOAccountEvent SODirection@
* 'Proto.SoEvent_Fields.bumpUser' @:: Lens' SOAccountEvent Data.Text.Text@ -}
data SOAccountEvent
= SOAccountEvent'_constructor {_SOAccountEvent'eventId :: !Data.ByteString.ByteString,
_SOAccountEvent'orderNumber :: !Data.Word.Word64,
_SOAccountEvent'accountNumber :: !Data.Word.Word64,
_SOAccountEvent'fromStatus :: !SOStatus,
_SOAccountEvent'toStatus :: !SOStatus,
_SOAccountEvent'targetStatus :: !SOStatus,
_SOAccountEvent'direction :: !SODirection,
_SOAccountEvent'bumpUser :: !Data.Text.Text,
_SOAccountEvent'_unknownFields :: !Data.ProtoLens.FieldSet}
deriving stock (Prelude.Eq, Prelude.Ord)
...
newtype SODirection'UnrecognizedValue
= SODirection'UnrecognizedValue Data.Int.Int32
deriving stock (Prelude.Eq, Prelude.Ord, Prelude.Show)
data SODirection
= SO_DIRECTION_FORWARD |
SO_DIRECTION_BACKWARD |
SODirection'Unrecognized !SODirection'UnrecognizedValue
deriving stock (Prelude.Show, Prelude.Eq, Prelude.Ord)
instance Data.ProtoLens.MessageEnum SODirection where
maybeToEnum 0 = Prelude.Just SO_DIRECTION_FORWARD
maybeToEnum 1 = Prelude.Just SO_DIRECTION_BACKWARD
maybeToEnum k
= Prelude.Just
(SODirection'Unrecognized
(SODirection'UnrecognizedValue (Prelude.fromIntegral k)))
showEnum SO_DIRECTION_FORWARD = "SO_DIRECTION_FORWARD"
showEnum SO_DIRECTION_BACKWARD = "SO_DIRECTION_BACKWARD"
showEnum
(SODirection'Unrecognized (SODirection'UnrecognizedValue k))
= Prelude.show k
readEnum k
| (Prelude.==) k "SO_DIRECTION_FORWARD"
= Prelude.Just SO_DIRECTION_FORWARD
| (Prelude.==) k "SO_DIRECTION_BACKWARD"
= Prelude.Just SO_DIRECTION_BACKWARD
| Prelude.otherwise
= (Prelude.>>=) (Text.Read.readMaybe k) Data.ProtoLens.maybeToEnum
instance Prelude.Bounded SODirection where
minBound = SO_DIRECTION_FORWARD
maxBound = SO_DIRECTION_BACKWARD
instance Prelude.Enum SODirection where
toEnum k__
= Prelude.maybe
(Prelude.error
((Prelude.++)
"toEnum: unknown value for enum SODirection: " (Prelude.show k__)))
Prelude.id (Data.ProtoLens.maybeToEnum k__)
fromEnum SO_DIRECTION_FORWARD = 0
fromEnum SO_DIRECTION_BACKWARD = 1
fromEnum
(SODirection'Unrecognized (SODirection'UnrecognizedValue k))
= Prelude.fromIntegral k
succ SO_DIRECTION_BACKWARD
= Prelude.error
"SODirection.succ: bad argument SO_DIRECTION_BACKWARD. This value would be out of bounds."
succ SO_DIRECTION_FORWARD = SO_DIRECTION_BACKWARD
succ (SODirection'Unrecognized _)
= Prelude.error
"SODirection.succ: bad argument: unrecognized value"
pred SO_DIRECTION_FORWARD
= Prelude.error
"SODirection.pred: bad argument SO_DIRECTION_FORWARD. This value would be out of bounds."
pred SO_DIRECTION_BACKWARD = SO_DIRECTION_FORWARD
pred (SODirection'Unrecognized _)
= Prelude.error
"SODirection.pred: bad argument: unrecognized value"
enumFrom = Data.ProtoLens.Message.Enum.messageEnumFrom
enumFromTo = Data.ProtoLens.Message.Enum.messageEnumFromTo
enumFromThen = Data.ProtoLens.Message.Enum.messageEnumFromThen
enumFromThenTo = Data.ProtoLens.Message.Enum.messageEnumFromThenTo
instance Data.ProtoLens.FieldDefault SODirection where
fieldDefault = SO_DIRECTION_FORWARD
instance Control.DeepSeq.NFData SODirection where
rnf x__ = Prelude.seq x__ ()
...
and when I use this in my test project and I try to show the whole record
...
mkSOAccountEvent ::
ByteString
-> Word64
-> Word64
-> SOStatus
-> SOStatus
-> SODirection
-> Text
-> SOAccountEvent
mkSOAccountEvent e o a f t d b =
defMessage
& eventId .~ e
& orderNumber .~ o
& accountNumber .~ a
& fromStatus .~ f
& toStatus .~ t
& targetStatus .~ t
& direction .~ d
& bumpUser .~ b
...
let ev1 = mkSOAccountEvent "e1" 1 11 SO_STATUS_DISPATCH SO_STATUS_QA SO_DIRECTION_FORWARD "Tester1"
putStrLn $ show ev1
let ev2 = mkSOAccountEvent "e2" 2 22 SO_STATUS_DISPATCH SO_STATUS_QA SO_DIRECTION_BACKWARD "Tester2"
putStrLn $ show ev2
...
but it doesn't print the direction field when I have it set to the first/default value
I think that I've removed all doubt that my custom code/protobuf has caused this behavior, and for some reason the generated haskell types are the culprit
The text was updated successfully, but these errors were encountered:
I've got the following defined in a protobuf (proto3)
which I've generated into the following haskell code with the compiler
and when I use this in my test project and I try to show the whole record
but it doesn't print the
direction
field when I have it set to the first/default valueI think that I've removed all doubt that my custom code/protobuf has caused this behavior, and for some reason the generated haskell types are the culprit
The text was updated successfully, but these errors were encountered: