mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-13 00:16:19 +03:00
Add a script
helper to DAML Script (#7272)
Factored out from #7264 We have enough cases of scenarios that don’t actually do ledger operations and need some hint for type inference. While adding type annotations works, this is a bit easier at least for the migration and some people might prefer it. No test, since this seems a bit excessive here :) changelog_begin - [DAML Script] Add a `script` function to aid type inference. This is the equivalent of `scenario`. changelog_end
This commit is contained in:
parent
6743bf5b9b
commit
11a477244a
@ -25,6 +25,7 @@ module Daml.Script
|
||||
, getTime
|
||||
, setTime
|
||||
, sleep
|
||||
, script
|
||||
) where
|
||||
|
||||
import DA.Functor
|
||||
@ -311,3 +312,11 @@ lift : Free ScriptF a -> Script a
|
||||
lift m = Script $ \s -> do
|
||||
a <- m
|
||||
pure (a, s)
|
||||
|
||||
-- | Convenience helper to declare you are writing a Script.
|
||||
--
|
||||
-- This is only useful for readability and to improve type inference.
|
||||
-- Any expression of type `Script a` is a valid script regardless of whether
|
||||
-- it is implemented using `script` or not.
|
||||
script : Script a -> Script a
|
||||
script = identity
|
||||
|
Loading…
Reference in New Issue
Block a user