Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想简单地添加 3.5 + floor 3.5 但会发生此错误: 约束中的模糊类型变量 't':由文字 '3.5' 产生的 'Fractional t' ... 由使用 floor 产生的'Integral t' ...
如何解决这个问题?
这是如何:3.5 + fromInteger (floor 3.5)。
3.5 + fromInteger (floor 3.5)
原因是floor的结果必须是Integral,但3.5必须是Fractional。的两个参数+必须具有相同的类型,但没有默认数据类型同时是Integraland Fractional,因此出现错误。
floor
Integral
3.5
Fractional
+