Table of Content

### Preface

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)

You can write the representation either

```y = f(x)
```

or

```y = f x
```

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.

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

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.

```z = i h g f x
```

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

```z = ((((i (h) ) g) f) x)
```

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.

`\$` 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.

```y = i \$ h \$ g \$ f x
```

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

```j = i . h . g . f
y = j x
```

Although

```y = i \$ h \$ g \$ f x
```

and

```y = i . h . g . f x
```

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.

[ ][photo-ss-xmonad-layout]

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.