[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vr / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / asp / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / qst / sci / soc / sp / tg / toy / trv / tv / vp / wsg / wsr / x] [Settings] [Home]
Board
/g/ - Technology

Simple question:
What does this syntax mean:

function :: (a->b) -> c

or

function :: (a->b) -> (c->d)

mean?

Can you give a simple example of both
>>
>>64107055

High order functions
>>
>>64107055
>(a->b) -> c
The type of a function that takes as first argument a function from type a to type b and returns a function from type c.
>(a->b) -> (c->d)
The type of a function that takes as first argument a function from type a to type b and returns a function from type c to type d.
>Can you give a simple example of both
No.
>>
>>64107055
Obfuscated, CIA code is what I see.
>>
>>64107127
>returns a function from type c.
Should say a value
It's not specific to Haskell, many languages support higher order functions.
>>
>>64107127
>(a->b) -> c
>The type of a function that takes as first argument a function from type a to type b and returns a function from type c.

in math notation does (a->b)->c mean

f(a) = b, f(b)=c

or does it mean f(a,b)=c?

I think it means the former based off what you said.
>>
>>64107171
It means f(g)=c with g:a->b
>>
>>64107195
ooooh, I see. So it means you have a function that takes in as arguments other functions, and the output of this function can be another function itself.

Is that right?
>>
>>64107221
Yeah, that would be the second case. The second one is for values. For example the function f that computes the derivative of a R->R differentiable function g in 0 has type (R->R)->R
>>
>>64107235
>The second one is for values
Fuck me in the ass till I pass out I meant first one is for values. The second one is functions to functions as you describe in >>64107221.
>>
>>64107235
>>64107252
Ok, this notation is much more clear now. Thank you.

Delete Post: [File Only] Style: