Skip to content

Conversation

@gnumonik
Copy link
Collaborator

Everything we wanted to move out of Cardax should be here now.

The TH really should be able to accommodate types with type variable arguments, so I'm going to see if I can get that working without too much hassle in a minute.

I didn't port over the BridgeBuilder stuff yet as I think it might generate duplicate imports due to an interaction with some hacks I made in the Printer module.

We probably need to think little bit about exactly how we want the API to look, especially w/r/t the Ledger types.

Gregg Sean hunter added 2 commits April 14, 2022 15:07
…ken flake.nix one that works. Copied over the template haskell hooks from Cardax.
…tweaked). All basic functionality should be implemented now.
@gnumonik
Copy link
Collaborator Author

Also my, uhm, "extremely elegant" nix hack to get this to work needs fixing. Use nix develop .#offchain for now. (I know how dumb that is but I'm not touching it now that it works)

…ts, implemented bridge for Ledger types w/ TyVar args.
@gnumonik
Copy link
Collaborator Author

Should now work for types with TyVar arguments. I might have missed a Ledger type or two but this is looking pretty complete.

Need fix nix / document / setup project tooling / test, but I'm happy with the progress today.

@gnumonik gnumonik requested a review from bladyjoker April 15, 2022 02:44
Gregg Sean hunter added 3 commits April 15, 2022 18:58
Comment on lines 1 to -2
{
description = "Generate PureScript data types from Haskell data types";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tbh I think you'd be better of c/p-ing the Nix setup in Cardax. But also, you can leave Nixification for some other day, we can tackle it together, and just focus on the Haskell side of things.

Copy link

@bladyjoker bladyjoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great, I want to get this in order soon, but we need to add some Nix love to this. Let me know if I can join the PR and add some Nix changes...

Comment on lines +1 to 2
# purescript-bridge (Plutus remix)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent read! Thanks for doing this!

Comment on lines +42 to +43


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need a chapter on Nix utilities and how to use it in projects.


packages: ./*.cabal

--tests: true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the --?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was temporary. During the initial nix conversation I needed to make a cabal.project file because... I don't remember, but I'm sure I had to. I wanted to leave that commented as a reminder to myself to, uh, hook up the tests.

@@ -0,0 +1,19 @@
module PlutusBridge (

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit; Perhaps Language.PureScript.Bridge.Plutus?

Comment on lines +3 to +4
module PlutusTx.LedgerTypes where

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit; consider placing this in Language.PureScript.Bridge.Plutus module if it makes sense to you

]

-- I'm leaving this commented b/c I'm not sure what the module structure for the ledger types should be.
-- My assumption was that, like Plutarch, we'd just shove everything into it's respective Plutus.V1.Ledger module

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, however, there's a slight complication in this story. CTL has its own Value type (quite a neat one) that they native support and work with.

What does that mean?

We'll if any of our Datum and Redeemers are using Value, it would make sense to map it to CTL Value and than have toLegacyValue :: CTL.Value -> Plutus.V1.Ledger.Value.Value and ``fromLegacyValue :: Plutus.V1.Ledger.Value.Value -> CTL.Value used in the ToData/FromData instances forCTL.Value`

Does that make sense? Well anyway we need to iron this out.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That also means that CTL would have to add this repo as a dependency, or we should have a Purescript module that does that conversion. Not sure what makes sense.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or Maybe we should have a little Purescript module here that takes care of such conversions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CTL should depend on us, I think. I ironed out the compatibility issues in the most recent PR here but I think it's a little confusing that we have to generate all the types except the three (?) that CTL has.

Or maybe it's not that confusing and we can just add a note, I dunno. You're probably in a better position to decide since you've worked on CTL directly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't CTL export all the ledger types? Like, isn't almost everyone who will use that library going to want those as well?

typeName ^== haskTypeName
return $
TypeInfo
{ _typePackage = "plutonomicon-cardano-browser-tx"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plutunomicon-cardano-transaction-lib

@bladyjoker bladyjoker mentioned this pull request Apr 19, 2022
2 tasks
@bladyjoker
Copy link

@gnumonik should we close this?

@bladyjoker bladyjoker closed this Jun 10, 2022
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.

3 participants