Type of anonymous function

I am trying to work out the first group of intermission exercises from Haskell Programming from First Principles.
Under GHCi I type the following and got the expected result.

ghci> let mTh = \x -> \y -> \z-> x * y * z
ghci> :t mTh
mTh :: Num a => a -> a -> a -> a

But when I write the function to a file then load it into GHCi, I got

ghci> :t mTh
mTh :: Integer -> Integer -> Integer -> Integer

Why the difference?
I am using GHCi 9.8.2 on Windows 11.

1 Like

Have a look at haskell - What is the monomorphism restriction? - Stack Overflow.

4 Likes

@strathspey if you want you can sandwich your code between ``` to style it monospace.

1 Like