# $$$

19 Jul 2015In my recent Haskell learning I’ve noticed it would be very easy to approach *an SML tier* of parentheses hell when writing a decent size app.

Then it happened. Function application.

As we can see from code or previous posts, functions in Haskell are left-associative, which means when you pass a result from a function into the parameter of another function you are going to be ((()()()()()()())))))))(((()))). Props to Atom for auto parenthesizing.

`$`

is a function application. It makes everything after it right associative.

Turn this (hw4.hs - get right most digit of any given number):

```
right_digit :: Int -> Int
right_digit x
| num_digits x == 1 = x
| otherwise = right_digit (x - (10 ^ (num_digits x - 1)))
```

Into:

```
right_digit :: Int -> Int
right_digit x
| num_digits x == 1 = x
| otherwise = right_digit $ x - 10 ^ (num_digits x - 1)
```

Neat.