Before you read. You can examine a neat `$`

coding style in my old screenshot. It is somehow weird, and it is probably, not something avaliable in other programming language.

**Source**:

If you love math. You are going to love Haskell.

I still don’t understand Math. Nor Haskell.

Let’s consider simple Mathematical function.

y = f(x)

Parantheses is not mandatory in Haskell. Haskell is a Functional Programming. It has different paradigm.

You can write the representation either

or

Space in haskell is left associative function application

Let’s consider this chained Mathematical function.

y = i( h( g( f(x) ) ) )

You can write this function in your haskell code with common notation. The result is the same representation as above.

This is error prone and you’ll get lost in parentheses easily.

Let’s see how space as left associative function application works by consider this representation.

After translating it back, with parentheses. It is actually, not something you are expecting.

Now we are facing problem of how to represent chained functions without parentheses.

So how do we solve the problem ? Off course with another function application.

Dollar to avoid parentheses.

http://learnyouahaskell.com/higher-order-functions#function-application

$ is right associative function application

Let’s again, consider this chained Mathematical function.

y = i( h( g( f(x) ) ) )

Yes, you can write this down again using $ infix notation for avoiding parantheses.

Function Composition.

Dot to chain function.

In math you can write this

(i . h . g . f )(x) = i( h( g( f(x) ) ) )

With haskell yo can simplified into this

Although

and

looks similar.

They are not always interchangeable.

Enough with math. How about real life coding ?

Yes, you can simplify doing those cumbersome parantheses by replacing it with `$`

infix operator as shown in my old screenshot below.

That’s my XMonad Configuration in Haskell that I’ve been using since 2014.

Remember. Dollar can make your life easier. After all, it is never to late to learn Math.

Happy Coding.

**Attribution-ShareAlike**4.0 International (CC BY-SA 4.0)