Haskell-to-Michelson Transpiler
parameter unit;
return unit;
storage tez;
code {CDR; DUP;
AMOUNT; CMPLT;
IF {FAIL} {UNIT; PAIR}}
module AtLeast where
import Juvix.Lib
main ∷ ((), Tez) → IO ((), Tez)
main ((), minimum) =
if amount > minimum
then return ((), minimum)
else fail
juvix compile atleast.hs atleast.tz
Why the Haskell frontend?
all in order to
Maximize ease of writing correct smart contracts
GHC
Haskell Frontend (what you write)
typecheck, desugar, simplify
=> GHC Core (typed lambda calculus - System FC)
Juvix
=> Juvix IR (untyped lambda calculus)
transform variables into stack ops, lift into stack-typed GADT
=> Michelson (final output)