-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Organize FromBytes
and ToBytes
#1073
Conversation
FromBytes
and ToBytes
foreign import _toBytes :: forall (a :: Type). a -> CborBytes | ||
|
||
class ToBytes a where | ||
toBytes' :: a -> CborBytes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not accurate for hash types. Emurgo/cardano-serialization-lib#263
Also, the original issue did not request a class here:
For toBytes, use Castable from untagged-union to remove the need to call asOneOf
What's the reason for the class? If we're keeping it, we need to make sure it's closed such that no other instances could be made, maybe with an instance chain and an error at the end of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for the class. Castable would work better. Ping me if you find the Castable machinery confusing, I have a grasp of it.
Replaced by #1285 |
Closes #560 .
Pre-review checklist
make format
)## Unreleased
header, using the appropriate sub-headings (### Added
,### Removed
,### Fixed
), and the links to the appropriate issues/PRs have been included