Skip to content
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

Closed

Conversation

MitchyCola
Copy link
Contributor

@MitchyCola MitchyCola commented Sep 29, 2022

Closes #560 .

Pre-review checklist

  • All code has been formatted using our config (make format)
  • Any new API features or modification of existing behavior is covered as defined in our test plan
  • The changelog has been updated under the ## Unreleased header, using the appropriate sub-headings (### Added, ### Removed, ### Fixed), and the links to the appropriate issues/PRs have been included

@MitchyCola MitchyCola changed the title Mitch/organize to bytes from bytes Organize FromBytes and ToBytes Oct 3, 2022
@MitchyCola MitchyCola marked this pull request as ready for review October 3, 2022 16:37
examples/AwaitTxConfirmedWithTimeout.purs Outdated Show resolved Hide resolved
src/Internal/Cardano/Types/Transaction.purs Outdated Show resolved Hide resolved
foreign import _toBytes :: forall (a :: Type). a -> CborBytes

class ToBytes a where
toBytes' :: a -> CborBytes
Copy link
Contributor

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.

Copy link
Member

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.

@klntsky klntsky changed the base branch from develop to klntsky/old-develop November 30, 2022 17:51
rynoV added a commit that referenced this pull request Dec 2, 2022
rynoV added a commit that referenced this pull request Dec 2, 2022
@rynoV
Copy link
Contributor

rynoV commented Dec 20, 2022

Replaced by #1285

@rynoV rynoV closed this Dec 20, 2022
@rynoV rynoV deleted the mitch/organize-ToBytes-FromBytes branch December 20, 2022 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve code organization (from_bytes / to_bytes)
4 participants