alphaHeavy / protobuf

An implementation of Google's Protocol Buffers in Haskell.
http://hackage.haskell.org/package/protobuf
BSD 3-Clause "New" or "Revised" License
96 stars 18 forks source link

Understanding the Monoid Instance usage and Optionals #1

Closed cartazio closed 11 years ago

cartazio commented 11 years ago

So my understanding is that currently every optional field needs to be a monoid instance to handle nicely being empty or not.

What i'm also noticing is that while optional field examples are given as

f:: Optional n (Last a),

this a) could just as well be f:: Optional n (First a),

b) if I want to get the value I care about at the end, i need to do getLast $ getValue f

to have a result type a which i guess i'm ok with since newtypes don't have any overhead.

cartazio commented 11 years ago

realized its a nonissue :)