Skip to content

let makes function too much specific

Say you define a myadd function:

let myadd x y = x + y

Then the type is Num a => a -> a -> a. If on the other hand, you define the method using currying:

let myadd2 \x -> \y -> x + y

The type is more specific: Integer -> Integer -> Integer. Strangely enough :t \x -> \y -> x + y returns the more general form.

URL: http://stackoverflow.com/questions/24481024/why-does-currying-anonymous-functions-change-haskells-type-inference-from-num-t

Edited by KommuSoft
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information