Skip to content

Commit e7f631c

Browse files
committed
Make Builtins.unsafeUncons use builtin list casing instead of head, tail calls
1 parent 1e7322a commit e7f631c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

plutus-tx/src/PlutusTx/Builtins.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ uncons = BI.caseList' Nothing (\h t -> Just (h, t))
491491

492492
-- | Uncons a builtin list, failing if the list is empty, useful in patterns.
493493
unsafeUncons :: BI.BuiltinList a -> (a, BI.BuiltinList a)
494-
unsafeUncons l = (BI.head l, BI.tail l)
494+
unsafeUncons l = BI.caseList' (error "Empty list") (,)
495495
{-# INLINE unsafeUncons #-}
496496

497497
-- | Turn a builtin pair into a normal pair, useful in patterns.

0 commit comments

Comments
 (0)