Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 670 Bytes

Avoid work duplication using plet.md

File metadata and controls

28 lines (20 loc) · 670 Bytes
imports

module Plutarch.Docs.UsePlet (pfoo, pfoo') where 
import Plutarch.Prelude

plet to avoid work duplication

Sometimes, when writing Haskell level functions working on Plutarch terms, you may find yourself needing to re-use the Haskell level function's argument(s) multiple times:

pfoo :: forall s. Term s PString -> Term s PString
pfoo x = x <> x

In such cases, you should use plet on the argument to avoid duplicating work.

pfoo' :: forall s. Term s PString -> Term s PString
pfoo' x = plet x $ \x' -> x' <> x'