haskell - How is function parameter defined? -
For this function:
plus1 = (+) 1
< / Ex>I can use it:
prelude & gt; Plus 1 3 4
Plus 1 type
plus1 :: integer - & gt; Integer
How is the function parameter integer being allowed here? In my function definition where the integer function parameter is defined?
I'm not sure what to expect from me but all the parameters coming from Java need to be defined as part of the law, but does it feel like going behind the scenes here Used to be?
(if we ignore the num
typeclass for a second and The excuse that only works on integer
s to work), (+)
is a type of function ->
is correct, but I've added them for clarity). This means that the argument of integer
type and one type of type does
So when you apply (+)
to the integer 1
, you actually get one of its functions as the result type Since the add1
holds, it is a type of task plus1 3
.
Comments
Post a Comment