Closed istathar closed 10 years ago
I'll take a look, I don't think there is test coverage for the Enumeration
support so it may well be broken for encoding.
tests/Main.hs line 140 seems to suggest you at least came close to testing it :)
Indeed :-) I'll see if I can get a fix hacked together tonight. The rest of the code is tested and in production.
Hmm... @sseveran reminded me that he's using Enumeration
and the above code does compile on my dev box. Looks like this was added in 12697d5d1be73c8d686c704456954c0d369d0d0f (including tests) but not uploaded to Hackage. Could you check and see if this works for you? If so I'll tag and upload a new release.
@NathanHowell ok!
Built and installed from Git and indeed it compiles now. Yeay!
Now my problem is the program, instead of running as expected, outputs:
$ ./program
program: <<loop>>
+RTS -xc
reports it's happening in Main.CAF. Not much help there. I am running GHC 7.6.3. Is that "too old", perhaps?
AfC
Forget that. Fixed!
I was playing with the derived classes, to see if something was up there. I tried dropping to
data ValueType
= EMPTY
| NUMBER
| TEXT
| REAL
deriving (Enum, Generic)
no joy. Then, forgetting I had previously had to do:
instance Show ValueType
because the compiler had earlier told me to, I added Show to deriving:
data ValueType
= EMPTY
| NUMBER
| TEXT
| REAL
deriving (Enum, Generic, Show)
which of course errorred. So I removed the manual declaration, and ta-da! Program works, protobuf is awesome, and order is returned to the galaxy.
Thanks for your help. Recommend a release!
AfC
Awesome. I've tagged a new release and upload it to Hackage: http://hackage.haskell.org/package/protobuf-0.1.2. Thanks for the help :+1:
Been fascinating [trying] to use protobuf; first time I've ever seen type families being used for real. I'm a little stuck trying to use an
enum
, though. With code along the following lines:Gives an error of the form:
which I'm not quite sure how to decipher. Without the enumeration it works very well indeed. I'm obviously missing something but it's not obvious to me what it is. Any suggestions would be welcome.
AfC