recreating some of the tutorial material. on my local VS Code project I’m trying to import DA.Math
as per the DataTypes and Imports tutorial.
VSCode complains about “missing module name”
I notice that the daml.yaml has a dependency section which for me looks as such:
dependencies:
- daml-prim
- daml-stdlib
- daml-script
this was generated via the java quickstart create .
Is there another dependency I should specify ?
thanks
1 Like
The compiler expects the header (with pragmas and imports) to be followed by a line module X where, where X needs to match your file name. So if your file is Main.daml, write module Main where.
eg if your file currently contains
import DA.Math
make it
import DA.Math
module Main where
EDIT: I obviously got the order wrong. imports go after the module declaration:
module main where
import DA.Math
1 Like
thanks, so I was copying in this from the tutorial:
import DA.Math
answer: Int
answer = 42
diagonal: Decimal → Decimal → Decimal
diagonal a b = (a^2 + b^2) ** 0.5
for which it complains about DA.Math
this doesnt’ work either (see below) but I expect that there must be a module terminator ? I know its white space sensitive if so you would think that should suffice ?

Sorry for the newbieness , want to make sure I understand the lang itself and not create contracts by robotic copy/paste.
I Googled for daml modules and could not readily find something that described the syntax and constraints, I’ll search thru the pdf I downloaded
VSCode is complaining about a parse error.
“Functions” is the name of the file
looked at the generated project and given that I changed it to this:
module Functions where
import DA.Math
which no longer complains about an import issue but warns that its a redundant import perhaps part of the implicit “Prelude” dependency set ?
“redundant” in this context means unused. If you use it, the warning should disappear. Here is a useless, minimal file that does not produce any warning:
module Main where
import DA.Math
v = DA.Math.exp
right , redundant since its of no current use, makes sense.
thanks