-
Notifications
You must be signed in to change notification settings - Fork 502
PlutusTx.Data.List & PlutusTx.BuiltinList - Feature Parity #7055
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
Merged
Changes from 17 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
b2a8ebc
PlutusTx.Data.List & PlutusTx.BuiltinList - Feature Parity
zeme-wana c4a0cc6
wip
zeme-wana efef2d2
wip
zeme-wana 266026a
wip
zeme-wana bf89cd9
wip
zeme-wana 7cc06cb
wip
zeme-wana eb452fd
wip
zeme-wana 4e938f4
wip
zeme-wana 51d349d
wip
zeme-wana 33617a9
wip
zeme-wana 5a2b342
wip
zeme-wana 8b12c98
donw
zeme-wana 25a5c91
wip
zeme-wana 826e41f
wip
zeme-wana a73d18f
wip
zeme-wana 43acb29
Merge branch 'master' into list-api
zeme-wana 3e3e2fc
wip
zeme-wana 4809d1b
Update plutus-tx/src/PlutusTx/BuiltinList.hs
zeme-wana 3e75024
done
zeme-wana 72c30ee
wip
zeme-wana b686a05
Update plutus-tx/src/PlutusTx/BuiltinList.hs
zeme-wana eff07e6
Removed dead code and appiled fourmolu
zeme-wana 090d021
done
zeme-wana 037c27b
wip
zeme-wana 8406c92
wip
zeme-wana 115f5d0
wip
zeme-wana b0a844e
donw
zeme-wana 587cfe3
done
zeme-wana 3850c7e
wip
zeme-wana 6c1ec8e
wip
zeme-wana 041b746
wip
zeme-wana 2451661
wip
zeme-wana File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
plutus-tx-plugin/test/BuiltinList/Budget/9.6/(++).eval.golden
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not asking to change this, but you're really brave introducing that symbolic name haha. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| cpu: 9002784 | ||
| mem: 33712 | ||
| size: 42 | ||
|
|
||
| (con (list integer) [1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10]) |
25 changes: 25 additions & 0 deletions
25
plutus-tx-plugin/test/BuiltinList/Budget/9.6/(++).pir.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| \(xs : list integer) -> | ||
| (let | ||
| b = list integer | ||
| in | ||
| \(f : integer -> b -> b) (acc : b) -> | ||
| letrec | ||
| !go : list integer -> b | ||
| = \(xs : list integer) -> | ||
| chooseList | ||
| {integer} | ||
| {all dead. b} | ||
| xs | ||
| (/\dead -> acc) | ||
| (/\dead -> | ||
| let | ||
| !x : integer = headList {integer} xs | ||
| !xs : list integer = tailList {integer} xs | ||
| in | ||
| f x (go xs)) | ||
| {b} | ||
| in | ||
| go) | ||
| (mkCons {integer}) | ||
| xs | ||
| xs |
14 changes: 14 additions & 0 deletions
14
plutus-tx-plugin/test/BuiltinList/Budget/9.6/(++).uplc.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| (program | ||
| 1.1.0 | ||
| (\xs -> | ||
| (\s -> s s) | ||
| (\s xs -> | ||
| force | ||
| (force (force chooseList) | ||
| xs | ||
| (delay xs) | ||
| (delay | ||
| (force mkCons | ||
| (force headList xs) | ||
| ((\x -> s s x) (force tailList xs)))))) | ||
| xs)) |
5 changes: 5 additions & 0 deletions
5
plutus-tx-plugin/test/BuiltinList/Budget/9.6/(<|).eval.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| cpu: 216462 | ||
| mem: 1032 | ||
| size: 9 | ||
|
|
||
| (con (list integer) [42,1,2,3,4,5,6,7,8,9,10]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| \(xs : list integer) -> mkCons {integer} 42 xs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| (program 1.1.0 (\xs -> force mkCons 42 xs)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| cpu: 2091812 | ||
| mem: 8694 | ||
| size: 53 | ||
|
|
||
| (constr 1) |
27 changes: 27 additions & 0 deletions
27
plutus-tx-plugin/test/BuiltinList/Budget/9.6/and.pir.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| let | ||
| data Bool | Bool_match where | ||
| True : Bool | ||
| False : Bool | ||
| in | ||
| letrec | ||
| !go : list bool -> Bool | ||
| = \(xs : list bool) -> | ||
| chooseList | ||
| {bool} | ||
| {all dead. Bool} | ||
| xs | ||
| (/\dead -> True) | ||
| (/\dead -> | ||
| let | ||
| !x : bool = headList {bool} xs | ||
| !xs : list bool = tailList {bool} xs | ||
| in | ||
| Bool_match | ||
| (ifThenElse {Bool} x True False) | ||
| {all dead. Bool} | ||
| (/\dead -> go xs) | ||
| (/\dead -> False) | ||
| {all dead. dead}) | ||
| {Bool} | ||
| in | ||
| \(xs : list bool) -> go xs |
19 changes: 19 additions & 0 deletions
19
plutus-tx-plugin/test/BuiltinList/Budget/9.6/and.uplc.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| (program | ||
| 1.1.0 | ||
| ((\go xs -> go xs) | ||
| ((\s -> s s) | ||
| (\s xs -> | ||
| force | ||
| (force (force chooseList) | ||
| xs | ||
| (delay (constr 0 [])) | ||
| (delay | ||
| ((\x -> | ||
| (\xs -> | ||
| force | ||
| (force ifThenElse | ||
| x | ||
| (delay (s s xs)) | ||
| (delay (constr 1 [])))) | ||
| (force tailList xs)) | ||
| (force headList xs)))))))) |
5 changes: 5 additions & 0 deletions
5
plutus-tx-plugin/test/BuiltinList/Budget/9.6/append.eval.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| cpu: 9002784 | ||
| mem: 33712 | ||
| size: 42 | ||
|
|
||
| (con (list integer) [1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10]) |
25 changes: 25 additions & 0 deletions
25
plutus-tx-plugin/test/BuiltinList/Budget/9.6/append.pir.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| \(xs : list integer) -> | ||
| (let | ||
| b = list integer | ||
| in | ||
| \(f : integer -> b -> b) (acc : b) -> | ||
| letrec | ||
| !go : list integer -> b | ||
| = \(xs : list integer) -> | ||
| chooseList | ||
| {integer} | ||
| {all dead. b} | ||
| xs | ||
| (/\dead -> acc) | ||
| (/\dead -> | ||
| let | ||
| !x : integer = headList {integer} xs | ||
| !xs : list integer = tailList {integer} xs | ||
| in | ||
| f x (go xs)) | ||
| {b} | ||
| in | ||
| go) | ||
| (mkCons {integer}) | ||
| xs | ||
| xs |
14 changes: 14 additions & 0 deletions
14
plutus-tx-plugin/test/BuiltinList/Budget/9.6/append.uplc.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| (program | ||
| 1.1.0 | ||
| (\xs -> | ||
| (\s -> s s) | ||
| (\s xs -> | ||
| force | ||
| (force (force chooseList) | ||
| xs | ||
| (delay xs) | ||
| (delay | ||
| (force mkCons | ||
| (force headList xs) | ||
| ((\x -> s s x) (force tailList xs)))))) | ||
| xs)) |
5 changes: 5 additions & 0 deletions
5
plutus-tx-plugin/test/BuiltinList/Budget/9.6/concat.eval.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| cpu: 7467372 | ||
| mem: 32100 | ||
| size: 75 | ||
|
|
||
| (con (list integer) [1,2,3,4]) |
42 changes: 42 additions & 0 deletions
42
plutus-tx-plugin/test/BuiltinList/Budget/9.6/concat.pir.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| let | ||
| !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r | ||
| = /\a r -> | ||
| \(z : r) (f : a -> list a -> r) (xs : list a) -> | ||
| chooseList | ||
| {a} | ||
| {all dead. r} | ||
| xs | ||
| (/\dead -> z) | ||
| (/\dead -> f (headList {a} xs) (tailList {a} xs)) | ||
| {r} | ||
| in | ||
| \(xss : list (list integer)) -> | ||
| (letrec | ||
| !go : list (list integer) -> list integer | ||
| = caseList' | ||
| {list integer} | ||
| {list integer} | ||
| [] | ||
| (\(x : list integer) (xs : list (list integer)) -> | ||
| let | ||
| !r : list integer = go xs | ||
| in | ||
| (let | ||
| b = list integer | ||
| in | ||
| \(f : integer -> b -> b) (acc : b) -> | ||
| letrec | ||
| !go : list integer -> b | ||
| = caseList' | ||
| {integer} | ||
| {b} | ||
| acc | ||
| (\(x : integer) (xs : list integer) -> f x (go xs)) | ||
| in | ||
| go) | ||
| (mkCons {integer}) | ||
| r | ||
| x) | ||
| in | ||
| go) | ||
| xss |
22 changes: 22 additions & 0 deletions
22
plutus-tx-plugin/test/BuiltinList/Budget/9.6/concat.uplc.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| (program | ||
| 1.1.0 | ||
| (\xss -> | ||
| (\caseList' -> | ||
| (\s -> s s) | ||
| (\s -> | ||
| caseList' | ||
| [] | ||
| (\x xs -> | ||
| (\acc -> | ||
| (\s -> s s) | ||
| (\s -> | ||
| caseList' acc (\x xs -> force mkCons x (s s xs)))) | ||
| (s s xs) | ||
| x))) | ||
| (\z f xs -> | ||
| force | ||
| (force (force chooseList) | ||
| xs | ||
| (delay z) | ||
| (delay (f (force headList xs) (force tailList xs))))) | ||
| xss)) |
5 changes: 5 additions & 0 deletions
5
plutus-tx-plugin/test/BuiltinList/Budget/9.6/concatMap.eval.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| cpu: 56224464 | ||
| mem: 237912 | ||
| size: 120 | ||
|
|
||
| (con (list integer) [1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10]) |
62 changes: 62 additions & 0 deletions
62
plutus-tx-plugin/test/BuiltinList/Budget/9.6/concatMap.pir.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| let | ||
| !caseList' : all a r. r -> (a -> list a -> r) -> list a -> r | ||
| = /\a r -> | ||
| \(z : r) (f : a -> list a -> r) (xs : list a) -> | ||
| chooseList | ||
| {a} | ||
| {all dead. r} | ||
| xs | ||
| (/\dead -> z) | ||
| (/\dead -> f (headList {a} xs) (tailList {a} xs)) | ||
| {r} | ||
| data Bool | Bool_match where | ||
| True : Bool | ||
| False : Bool | ||
| in | ||
| \(xss : list integer) -> | ||
| (letrec | ||
| !go : list integer -> list integer | ||
| = caseList' | ||
| {integer} | ||
| {list integer} | ||
| [] | ||
| (\(x : integer) -> | ||
| letrec | ||
| !go : integer -> list integer | ||
| = \(n : integer) -> | ||
| Bool_match | ||
| (ifThenElse | ||
| {Bool} | ||
| (lessThanEqualsInteger n 0) | ||
| True | ||
| False) | ||
| {all dead. list integer} | ||
| (/\dead -> []) | ||
| (/\dead -> | ||
| mkCons {integer} x (go (subtractInteger n 1))) | ||
| {all dead. dead} | ||
| in | ||
| \(xs : list integer) -> | ||
| let | ||
| !ys : list integer = go xs | ||
| !l : list integer = go 2 | ||
| in | ||
| (let | ||
| b = list integer | ||
| in | ||
| \(f : integer -> b -> b) (acc : b) -> | ||
| letrec | ||
| !go : list integer -> b | ||
| = caseList' | ||
| {integer} | ||
| {b} | ||
| acc | ||
| (\(x : integer) (xs : list integer) -> f x (go xs)) | ||
| in | ||
| go) | ||
| (mkCons {integer}) | ||
| ys | ||
| l) | ||
| in | ||
| go) | ||
| xss |
38 changes: 38 additions & 0 deletions
38
plutus-tx-plugin/test/BuiltinList/Budget/9.6/concatMap.uplc.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| (program | ||
| 1.1.0 | ||
| (\xss -> | ||
| (\caseList' -> | ||
| (\s -> s s) | ||
| (\s -> | ||
| caseList' | ||
| [] | ||
| (\x -> | ||
| (\go xs -> | ||
| (\ys -> | ||
| (\l -> | ||
| (\s -> s s) | ||
| (\s -> | ||
| caseList' | ||
| ys | ||
| (\x xs -> force mkCons x (s s xs))) | ||
| l) | ||
| (go 2)) | ||
| (s s xs)) | ||
| ((\s -> s s) | ||
| (\s n -> | ||
| force | ||
| (force ifThenElse | ||
| (lessThanEqualsInteger n 0) | ||
| (delay []) | ||
| (delay | ||
| (force mkCons | ||
| x | ||
| ((\x -> s s x) | ||
| (subtractInteger n 1)))))))))) | ||
| (\z f xs -> | ||
| force | ||
| (force (force chooseList) | ||
| xs | ||
| (delay z) | ||
| (delay (f (force headList xs) (force tailList xs))))) | ||
| xss)) |
5 changes: 5 additions & 0 deletions
5
plutus-tx-plugin/test/BuiltinList/Budget/9.6/cons.eval.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| cpu: 216462 | ||
| mem: 1032 | ||
| size: 9 | ||
|
|
||
| (con (list integer) [0,1,2,3,4,5,6,7,8,9,10]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| \(xs : list integer) -> mkCons {integer} 0 xs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| (program 1.1.0 (\xs -> force mkCons 0 xs)) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why to hide only this one?
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.
Name collision with
mapMaybefromPlutusTx.Prelude.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.
I suggest to import explicitly only the used symbols. Alternatively,
Import PlutusTx.List qualified as List