Showing changes from revision #12 to #13:
Added | Removed | Changed
-> operator is right associative.For example see the type definition of div.
> :t div
:: (Integral a) => a -> a -> a
a1 -> a2 -> a3-> operator, a1 -> (a2 -> a3)So the type definition roughly translates to:
a1 applied to function div evaluates a functiona2 applied to this function evaluates to a value of type a3Calling divwith parameters 10 and 2 give the result 5.
> div 10 2
=> 5
(div 10) 2This means that the function returned by applying 10 to div translates to 10/x. 2 applied to this function evaluates to 5. 10 is of type a1, 2 of type a2 and 5 of type a3.
The infix operator of div works in the same manner.
> :t (/)
:: (Fractional a) => a -> a -> a
> (/) 10 2
=> 5.0
> 10 / 2
=> 5.0
> 10 `div` 2
=> 5