0
我定义我的模型是Model = Dict Int String
然而,在编译时使用诠释或数字,我得到number
代替Int
所以它是错误的:在榆树字典
The 2nd argument to function `get` is causing a mismatch.
71| Dict.get 3 model
^^^^^
Function `get` is expecting the 2nd argument to be:
Dict number v
But it is:
Model
,不幸的是榆树REPL不返回Dict number
同样的事情而不是Dict Int
。
> Dict.fromList [ (1, {a= 1})]
Dict.fromList [(1,{ a = 1 })] : Dict.Dict number { a : number1 }
某些语言如Haskell中暴露Int
作为以及Integer
以及number
我怎么能强迫它是整数?
我需要向下收缩我的代码到SCCCE例如http://sscce.org –
上述答案的重要组成部分是,'货号'被定义为一个'Dict'别名。 请确保您的模型定义使用'alias'关键字。否则,您将您的模型定义为单个案例区分联盟。 'type alias Model = Dict Int String' – Adrian