Skip to content

Commit

Permalink
Fix "un-rolling" a list type.
Browse files Browse the repository at this point in the history
  • Loading branch information
Unisay committed Jun 3, 2024
1 parent f34e999 commit c892262
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions plutus-tx/src/PlutusTx/Blueprint/Definition/Unroll.hs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ type family Unroll (p :: Type) :: [Type] where
Unroll BuiltinString = '[BuiltinString]
Unroll (BuiltinList a) = Prepend (BuiltinList a) (GUnroll (Rep a))
Unroll BuiltinByteString = '[BuiltinByteString]
Unroll [a] = Unroll a
Unroll p = Prepend p (GUnroll (Break (NoGeneric p) (Rep p)))

-- | Detect stuck type family: https://blog.csongor.co.uk/report-stuck-families/#custom-type-errors
Expand Down
9 changes: 9 additions & 0 deletions plutus-tx/test/Blueprint/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,18 @@ $( PlutusTx.asData
testUnrollNop :: Unroll Nop :~: '[Nop]
testUnrollNop = Refl

testUnrollListNop :: Unroll [Nop] :~: '[Nop]
testUnrollListNop = Refl

testUnrollListsNop :: Unroll [[[Nop]]] :~: '[Nop]
testUnrollListsNop = Refl

testUnrollBaz :: Unroll Baz :~: [Baz, Integer]
testUnrollBaz = Refl

testUnrollListBaz :: Unroll [Baz] :~: [Baz, Integer]
testUnrollListBaz = Refl

testUnrollZap :: Unroll Zap :~: [Zap, Nop, Integer, Bool]
testUnrollZap = Refl

Expand Down

0 comments on commit c892262

Please sign in to comment.