Skip to content

Commit

Permalink
Update generator and parser to support Arrays.
Browse files Browse the repository at this point in the history
  • Loading branch information
Unisay committed Jan 29, 2025
1 parent 742c1cf commit 4794c07
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions plutus-core/plutus-core/src/PlutusCore/Parser/Type.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import PlutusCore.Parser.ParserCommon
import Control.Monad
import Data.ByteString (ByteString)
import Data.Text (Text)
import Data.Vector.Strict qualified as Strict
import Text.Megaparsec hiding (ParseError, State, many, parse, some)

-- | A PLC @Type@ to be parsed. ATM the parser only works
Expand Down Expand Up @@ -138,6 +139,7 @@ defaultUni = choice $ map try
, someType @_ @() <$ symbol "unit"
, someType @_ @Bool <$ symbol "bool"
, someType @_ @[] <$ symbol "list"
, someType @_ @Strict.Vector <$ symbol "array"
, someType @_ @(,) <$ symbol "pair"
, someType @_ @Data <$ symbol "data"
, someType @_ @BLS12_381.G1.Element <$ symbol "bls12_381_G1_element"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,11 @@ instance KnownKind k => Arbitrary (MaybeSomeTypeOf k) where
, JustSomeType DefaultUniBLS12_381_MlResult
]
SingType `SingKindArrow` SingType ->
[genDefaultUniApply | size > 10] ++
[pure $ JustSomeType DefaultUniProtoList]
[ genDefaultUniApply | size > 10 ]
++ map pure
[ JustSomeType DefaultUniProtoList
, JustSomeType DefaultUniProtoArray
]
SingType `SingKindArrow` SingType `SingKindArrow` SingType ->
-- No 'genDefaultUniApply', because we don't have any built-in type constructors
-- taking three or more arguments.
Expand Down

0 comments on commit 4794c07

Please sign in to comment.