| > https://tech.fpcomplete.com/haskell/tutorial/operators/ You're a prime example of a person who reads a page on the Internet and takes it at a face value without understanding the meaning and the context behind the words: > One of the most common operators, and source of initial confusion, is the $ operator. All this does is apply a function. Did you miss the part that says "All this does is apply a function"? Here's how you define (+) among other things: https://hackage.haskell.org/package/ghc-internal-9.1201.0/do... instance Num Int where
I# x + I# y = I# (x +# y)
whereas (+#) is defined as a bridge from unboxed ints provided by the runtime to their efficient low-level machine representation, accomodating all instances of a data type defined as `Int = I# Int#` (the left-hand side is the name of the type, the right-hand side is the name of a constructor that accepts a single value of type Int# - the low-level primitive provided by the GHC implementation).The (+) in `I# x + I# y =` is a function definition in infix form. That's the same form you can use for any other infix function if you wish so: ghci> a `iAmHelping` b = a b + b
ghci> :t iAmHelping
iAmHelping :: Num a => (a -> a) -> a -> a
> Oh you mean the things that look like operator, behave like operatorsLet me see your regular operators do the following, then we talk: plus = (+)
a = (2 +)
c = (2 `plus`)
c' = plus 2
d = (+) 2
d' = (+ 2)
e = 2 `plus` 2
f = 2 + 2
I'm glad that's the only thing you object to, though. |
Did you miss the part where it's called an "operator"? Your claim was that Haskell doesn't have operators.
I guess you're a prime example of someone that can't remember what the debate is.