hexresearch / hschain-utxo

UTXO-based contracts for hschain
0 stars 0 forks source link

Implements pattern binds #225

Closed anton-k closed 3 years ago

anton-k commented 3 years ago

It's possible to write code with pattern binds for high-level language:


 data User = User Text Int

 (bs, pair) = getArgs
 john = User "john" 10
 User name _ = john

 main =
   let (a, b) = pair
   in  appendBytes (appendBytes (sha256 bs) (serialise (a + b + c + age  + lengthText name))) d
   where
     (c, d) = getBoxArgs getSelf
     (User _ age) = john