質問1ハスケル:GHCiの中にエラー・メッセージ「には、インスタンスを」理解していない
こんにちは、WinGHCiに私が意図的に次のコードの間違った部分を行う場合:
3 4
を次にエラーメッセージI取得は
<interactive>:1:1:
No instance for (Num (a0 -> t0))
arising from the literal `3'
Possible fix: add an instance declaration for (Num (a0 -> t0))
In the expression: 3
In the expression: 3 4
In an equation for `it': it = 3 4
No instance for (Num (a0 -> t0))
はどういう意味ですか?
質問2
なぜ次のコード:
(+) 2 3 4
<interactive>:1:7:
No instance for (Num (a0 -> t0))
arising from the literal `3'
Possible fix: add an instance declaration for (Num (a0 -> t0))
In the second argument of `(+)', namely `3'
In the expression: (+) 2 3 4
In an equation for `it': it = (+) 2 3 4
収率コードの第2部分からわずかに異なるエラー:最初のすなわち
2+3 4
<interactive>:1:3:
No instance for (Num (a1 -> a0))
arising from the literal `3'
Possible fix: add an instance declaration for (Num (a1 -> a0))
In the expression: 3
In the second argument of `(+)', namely `3 4'
In the expression: 2 + 3 4
コードの部分にはNo instance for (Num (a0 -> t0))
があり、コードの2番目の部分にはNo instance for (Num (a1 -> a0))
があります。
を[応答がehirdする](質問の回答のコメントから移動):
1)私は後者の2つの式が異なっている感謝していますが、私は理解しようとしないことを言っていますなぜ通訳者が前者には(Num (a0 -> t0))
、後者には(Num(a1 -> a0))
を選んだのでしょうか?
2)こんにちは、前者では、「機能のためのNumインスタンスはありません」と言いますとどういう意味ですか?申し訳ありませんが、インスタンスの概念が何であるかはっきりしていません。さらに好奇心の外に、インスタンスNum (a -> b)
を使用して何らかの理由で通訳者に3 4
を4 modulo 3
と解釈させることができますか?
うわあ、この詳細でよく説明された説明をありがとうございました。ほんとうにありがとう。私は、あなたが書いたものをすべて消化する前に、Haskellのウェブサイトで指定された書籍のいくつかをヒットし、あなたの記事にもう一度戻ってくる必要があると思います。ありがとうございました。 – artella