関数型プログラミング言語Haskell Part5
■ このスレッドは過去ログ倉庫に格納されています
0230デフォルトの名無しさん
2006/06/15(木) 12:08:16下のページを参考にしているのですが、関数の合成がうまく行きません。
http://www.shido.info/hs/haskell3.html
何故なのでしょうか?
foo x y = x * y
bar x = x - 1
*Main> bar $ foo 5 2
9
*Main> (bar . foo) 5 2
<interactive>:1:
No instance for (Num (a -> a))
arising from use of `bar' at <interactive>:1
In the first argument of `(.)', namely `bar'
In the definition of `it': it = (bar . foo) 5 2
■ このスレッドは過去ログ倉庫に格納されています