<div dir="ltr">I'm going through "Haskell Programming from first principles" and in section 7.3 Anonymous Functions there is an exercise on converting multiple parameters to anonymous functions, and it asks:<div><br></div><div>1. Which (two or more) of the following are equivalent?<br></div><div><br></div><div><div>mTh1 x y z = x * y * z</div><div>mTh2 x y = \z -> x * y * z</div><div>mTh3 x = \y -> \z -> x * y * z</div><div>mTh4 = \x -> \y -> \z -> x * y * z<br></div></div><div><br></div><div>So I created a file, anon.hs (attached):</div><div><br></div><div><div>module Anon where</div><div><br></div><div>mTh1 x y z = x * y * z</div><div>mTh2 x y = \z -> x * y * z</div><div>mTh3 x = \y -> \z -> x * y * z</div><div>mTh4 = \x -> \y -> \z -> x * y * z</div></div><div><br></div><div>I load that into ghci and check the function types:</div><div><br></div><div><div>$ ghci anon.hs </div><div>GHCi, version 8.2.1: <a href="http://www.haskell.org/ghc/">http://www.haskell.org/ghc/</a>  :? for help</div><div>[1 of 1] Compiling Anon             ( anon.hs, interpreted )</div><div>Ok, 1 module loaded.</div><div>*Anon> :t mTh1</div><div>mTh1 :: Num a => a -> a -> a -> a</div><div>*Anon> :t mTh2</div><div>mTh2 :: Num a => a -> a -> a -> a</div><div>*Anon> :t mTh3</div><div>mTh3 :: Num a => a -> a -> a -> a</div><div>*Anon> :t mTh4</div><div>mTh4 :: Integer -> Integer -> Integer -> Integer</div></div><div><br></div><div>Why is mTh4 different from the rest?</div><div><br></div><div><br></div><div>On the flip side If I enter "mTh4 = \x -> \y -> \z -> x * y * z" directly in ghci command line then it has same type as the others:</div><div><br></div><div><div>$ ghci</div><div>GHCi, version 8.2.1: <a href="http://www.haskell.org/ghc/">http://www.haskell.org/ghc/</a>  :? for help</div><div>Prelude> mTh4 = \x -> \y -> \z -> x * y * z</div><div>Prelude> :t mTh4</div><div>mTh4 :: Num a => a -> a -> a -> a</div></div><div><br></div><div><br></div><div>-- Wink</div><div><br></div></div>