Is the `ApplicativeDo` language pragma implicitly enabled in Daml? Update: no, it isn't
- gyorgybalazsiOP 1
The Daml docs says about the Commands data type:
“This is used to build up the commands sent as part of
submit. If you enable theApplicativeDoextension by adding{-# LANGUAGE ApplicativeDo #-}at the top of your file, you can usedo-notation but the individual commands must not depend on each other and the last statement in adoblock must be of the formreturn exprorpure expr.”See Module Daml.Script — Daml SDK 1.10.0 documentation
Is my observation correct that enabling this pragma is not needed any more?
- cocreature 2
The pragma is still needed but you only need it if you actually make use of do notation. E.g., the following works without the pragma because the
dois redundant.submit p $ do createCmd …This one does not:
submit p $ do c1 <- createCmd … c2 <- createCmd pure (c1, c2) - gyorgybalazsi 1
Thank you!
- Stephen 4
Further to what @cocreature said, it is only needed for
dos associated withCommands.Script(theActionthatsubmitproduces in this context) can usedowithout the pragma.If you need this pragma and haven’t added it, compilation will fail. Conversely, if you don’t have it and your code is compiling, you don’t need it.
- gyorgybalazsi 1
Thank you!