【问题标题】:Trouble using the 'date' function inside a 'create' statement or 'exercise' statement在“create”语句或“exercise”语句中使用“date”函数时遇到问题
【发布时间】:2019-02-18 20:06:36
【问题描述】:

这是一个代码sn-p:

car1AddCid <- submit dealer1 do
    carCid <- create Car with
      dealer = dealer1
      insurer = insurance1
      vin = "1A"
      daily_insurance_rate = 1.5 
      daily_rate_APD = 0.16
      covered = False 
      observers = [insurance1]
      date_vehicle_added = date 1970 Jan 1   -- must be initialized to something
    exercise carCid Add_Car with startCoverage = date 2019 Apr 5

不接受使用日期功能。我尝试将yyyy mmm d 放入""()。如何指定日期?

【问题讨论】:

    标签: daml


    【解决方案1】:

    您指定日期的方式看起来不错。

    由于您在 Syntax errors in Main.daml 中发布了更完整的代码 sn-p,我可以大胆猜测并说您缺少 DA.Date 标准库。尝试将行 import DA.Date 添加到文件的开头:

    daml 1.2
    module Main where
    
    import DA.Date
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-10
      • 2020-01-27
      • 1970-01-01
      • 1970-01-01
      • 2019-11-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多