3 ms·
> Okay, so what does this mean? I thought it was `f x -> x * x` is a function definition, right? Or am I completely mistaken here? In this case, it's a type si
by masklinn 15y ago
> Okay, so what does this mean? I thought it was `f x -> x * x` is a function definition, right? Or am I completely mistaken here?
In this case, it's a type signature for a curried function. So
a -> m b
is a function taking a value of type `a` and returning a value of type `m b`. In C# you would write:
Function<A, M<B>>
so `m a -> (a -> m b) -> m b` is a function taking a value of type `m a` and a function with signature `a -> m b` and returning a function of type `m b`. Translating to C# again,
Function< M<A>, Function<A, M<B>>, M<B> >
> Or am I completely mistaken here?
Pretty much yeah. In haskell, a function is either a top-level binding:
someFunction arg = doSomething arg
or an anonymous function which is introduced by the character `\` (because `\` looks like `λ`, kind-of):
\arg -> doSomething arg
In the expression you quoted, there is no function name, these are all types. The function name in this case is `(>>=)`