Juvix

Haskell-to-Michelson Transpiler

Michelson

parameter unit;
return unit;
storage tez;
code {CDR; DUP;
      AMOUNT; CMPLT;
      IF {FAIL} {UNIT; PAIR}}

Haskell

module AtLeast where

 

import           Juvix.Lib

 

main ∷ ((), Tez) → IO ((), Tez)
main ((), minimum) =

  if amount > minimum

        then return ((), minimum)

  else fail

Juvix: Haskell => Michelson

juvix compile atleast.hs atleast.tz

Why the Haskell frontend?

  • Mature, consistent syntax
  • Existing tooling
  • Extremely capable typesystem
  • Compilation pipeline we can partially reuse

 

all in order to

 

Maximize ease of writing correct smart contracts

Compilation Pipeline

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)

Implementation State

Future Plans

  • Online editor
  • Simple standard libraries / contracts
  • Verification assistance
  • Control flow visualization
  • Dependent types 

Juvix: Haskell-to-Michelson Transpiler [Tezos NYC 26/10/17]

By Christopher Goes

Juvix: Haskell-to-Michelson Transpiler [Tezos NYC 26/10/17]

Juvix - Haskell-to-Michelson Transpiler. Deck for the Tezos NYC meetup on 26/10/2017. See https://github.com/cwgoes/juvix.

  • 347