Type of an expression in haskell -
i'm new haskell , i'm having little bit of trouble understanding of concepts of language.
i have following expression:
\f x → (f x,f 1)
and understanding, can that:
at first, can't f because have no information, can anything.
then judging application of (f x) can it's function of type a->b x::a
then judging application of (f 1) can of type integer, therefore x same type
then don't understand why whole expression of type:
(integer → b) → integer → (b, b)
i have little guess , i'm going that:
(integer → b) type of function f, receives , integer , returns type b
integer type of x
(b b) type of 2 functions called?
can point me in right direction please? thank you
you correct.
since f applied 1 :: integer, f :: integer -> b.
and since f applied x, x :: integer.
and since result of lambda tuple of applications of f, result type (b, b).
so type of lambda function takes of type of f function takes integer tuple of (b, b).
edit
c b = b assume b :: t1.
since a applied b, can a :: t1 -> t.
since c takes of type of b (t1) of type of a (t1 -> t) result of application of a b (t), can c :: t1 -> (t1 -> t) -> t.
Comments
Post a Comment