Closed brunjlar closed 4 years ago
Hi Lars - I would advise using the latest version, which is at
https://alpha.marlowe.iohkdev.io/ https://alpha.marlowe.iohkdev.io/
We’ve made a small number of changes on the version you were using, Refund is now Close, but I also had to change the definition of stakeId to ValueId “1”. The tutorial accessed from that site is up to date
Here’s the complete program, which simulates OK in the site above. OTOH the analysis in that site seems to be timing out: if you want to try the development version at david.marlowe.iohkdev.io http://david.marlowe.iohkdev.io/ you’ll see that the corrected contract passes the analysis too.
Best regards.
Simon
{-# LANGUAGE OverloadedStrings #-} module Swap where
import Language.Marlowe
main :: IO () main = print . pretty $ contract
{- Simply swap two payments between parties -} contract :: Contract contract = Let stakeId (Constant 100) $ When [ Case (Deposit "Alice" "Alice" stake) $ When [ Case (Deposit "Bob" "Bob" stake) $ When [ Case (Notify TrueObs) $ Pay "Bob" (Party "Alice") stake Close , Case (Notify FalseObs) $ Pay "Alice" (Party "Bob") stake Close ] 20 Close ] 10 Close ] 5 Close where stakeId = ValueId "1" stake = UseValue stakeId
On 19 Oct 2019, at 00:03, Lars Brünjes notifications@github.com wrote:
{-# LANGUAGE OverloadedStrings #-} module Swap where
import Language.Marlowe
main :: IO () main = print . pretty $ contract
{- Simply swap two payments between parties -} contract :: Contract contract = Let stakeId (Constant 100) $ When [ Case (Deposit "Alice" "Alice" stake) $ When [ Case (Deposit "Bob" "Bob" stake) $ When [ Case (Notify TrueObs) $ Pay "Bob" (Party "Alice") stake Refund , Case (Notify FalseObs) $ Pay "Alice" (Party "Bob") stake Refund ] 20 Refund ] 10 Refund ] 5 Refund where stakeId = ValueId 1 stake = UseValue stakeId
Simon Thompson | Professor of Logic and Computation School of Computing | University of Kent | Canterbury, CT2 7NF, UK s.j.thompson@kent.ac.uk mailto:s.j.thompson@kent.ac.uk | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt http://www.cs.kent.ac.uk/~sjt
There seems to be a bug in the Playground at https://prod.meadow.marlowe.iohkdev.io/
I enter the following Haskell program into the "Haskell Editor" tab:
This program compiles just fine, but when I send it to "Simulation", I get a weird error in line 2, saying "expected '-'".