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 + フロア 3.5 を追加したいのですが、次のエラーが発生します: 制約内の型変数 't' が曖昧です: リテラル '3.5' に起因する '分数 t'... フロアの使用に起因する '整数 t'...
この問題を解決するにはどうすればよいですか?
これが方法です:3.5 + fromInteger (floor 3.5)。
3.5 + fromInteger (floor 3.5)
その理由は、floorの結果はである必要Integralがありますが、である3.5必要があるためFractionalです。の両方の引数は同じ型である必要がありますが、との両方で+あるデフォルトのデータ型がないため、エラーが発生します。IntegralFractional
floor
Integral
3.5
Fractional
+