daml/compiler/damlc/tests/PlatformIndependence.daml
Moritz Kiefer 8830eaa2ec
Drop controller can syntax from compiler tests (#10807)
You definitely want to review this with whitespace disabled.

changelog_begin
changelog_end
2021-09-08 15:28:09 +02:00

41 lines
902 B
Haskell

-- Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
-- SPDX-License-Identifier: Apache-2.0
module PlatformIndependence where
import DA.Stack
type AssetId = ContractId Asset
data ADT
= Foo
| Bar
| Baz
give : HasCallStack => Party -> Party -> Text -> Update (ContractId Asset)
give issuer owner name = do
let fs = [ srcLocFile srcLoc | (_t, srcLoc) <- getCallStack callStack]
trace (show fs) $ create Asset{..}
incompletePattternMatch : ADT -> Update ()
incompletePattternMatch adt =
case adt of
Foo -> pure ()
Bar -> pure ()
template Asset
with
issuer : Party
owner : Party
name : Text
where
ensure name /= ""
signatory issuer
choice Give : AssetId
with
newOwner : Party
controller owner
do incompletePattternMatch Baz
create this with
owner = newOwner