-
Notifications
You must be signed in to change notification settings - Fork 476
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
[Builtins] Add the 'dropList' builtin #6468
base: master
Are you sure you want to change the base?
Changes from all commits
82b2f45
e22a57b
ad25ce7
41ea9b6
5112e9b
442beb4
e8c0b9d
d36d0f8
4b5a204
d0192b7
df127f4
05d82e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
all a. integer -> list a -> list a |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,3 +146,4 @@ isCommutative = \case | |
CountSetBits -> False | ||
FindFirstSetBit -> False | ||
ExpModInteger -> False | ||
DropList -> False |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ import Data.Data (Data) | |
import Data.Foldable qualified as Foldable | ||
import Data.Hashable (Hashable (..)) | ||
import Data.Kind (Type) | ||
import Data.List qualified as Haskell | ||
import Data.Text as Text (Text, empty) | ||
import Data.Text.Encoding as Text (decodeUtf8, encodeUtf8) | ||
import GHC.Generics (Generic) | ||
|
@@ -408,6 +409,10 @@ chooseList :: BuiltinList a -> b -> b -> b | |
chooseList (BuiltinList []) b1 _ = b1 | ||
chooseList (BuiltinList (_:_)) _ b2 = b2 | ||
|
||
{-# OPAQUE drop #-} | ||
drop :: Integer -> BuiltinList a -> BuiltinList a | ||
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. Why not 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. For consistency, we also have |
||
drop i (BuiltinList xs) = BuiltinList (Haskell.genericDrop i xs) | ||
|
||
{-# OPAQUE caseList' #-} | ||
caseList' :: forall a r . r -> (a -> BuiltinList a -> r) -> BuiltinList a -> r | ||
caseList' nilCase _ (BuiltinList []) = nilCase | ||
|
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.
Should this also go in PlutusTx.Prelude? I seem to remember that the contents of that file are kind of random though.