Size limit: type "bar" was deduced in order to have a common type

In the snippet below, I don’t see why I have to compose fand ghow the function works fooand why it does not work the way it tries to execute the function bar.

let f a b = a,b
let g (a : 'a) (b : 'a) = a

let (>!) f1 f2 =
    fun a b ->
        let (x,y) = f1 a b
        f2 x y

let foo = fun a b -> (f >! g) a b
let bar = f >! g

Can someone explain to me why it bardoesn't work? Given that it fooalso has a generic type, it makes no sense to me.

+4
source share
1 answer

foois a function, and baris a value. Yes, this is a function type value, but still a value. There is a subtle difference.

F # "", foo , fun -> let.

bar, , - , ( >!). F # ( " " ), ( ), ( ) , , " ". ( , )

F #, ML. F # SML.

+7

Source: https://habr.com/ru/post/1654027/


All Articles