Fun fact: you can write a Daml template in one line (though this is not very useful)
Outreach3 posts433 views6 likesLast activity Jan 2022
GY
gyorgybalazsiOP
Oct 2021I was playing around a bit with the Daml template syntax.
Using Haskell’s alternative syntax for indentation, new line and do blocks, you can transform a Daml template like this.
The second version is written in one line. This is just interesting, because it makes your code totally unreadable.
gist.github.comhttps://gist.github.com/gyorgybalazsi/942ece43d556f018549c88c6614c189c
oneliner.hs
module Token where
template Token
with
issuer : Party
owner : Party
amount : Int
createdAt : Time
where
signatory issuer
This file has been truncated. show original
QU
quidagis
Oct 2021Hi @gyorgybalazsi that is quite interesting.
While a One-Liner is an odd beast, if you wanted to write a Bash or Python-based Generator, that inputted the various variable values, into that string and made a valid Template, that’d be handy.
BE
Ben_M
Jan 2022Nicely done 