QUESTION:

Somehow the function to check if a value is less than 0 went from

to

I don’t understand why this is possible.

ANSWER:

In Haskell, we have something called *operator sections* which is essentially eta reduction on steroids

Consider partial application:

`map`

takes a function a list, returning a list

I can partially apply map to get a function from list to list

Partial application is a case of eta reduction, I could have written the above as

Sections: It is the same for infix operators.

If I define a symbol-looking thing with parens, it becomes an infix operator:

I can call this function like so:

I can also partially apply it:

But, partial application fills in the parameters from the left. Infix operators are more flexible, I can write the previous as

Now, I can partially apply on the left or right!

This really passes the parameter at the correct position, to check we can examine the cons operator

```
(:) :: a -> [a] -> [a]
prependElt :: a -> ([a] -> [a])
prependElt x = (x :)
extendList :: [a] -> (a -> [a])
extendList xs = (: xs)
```

Try them out in GHCi!

**Exercises**

show that

`prependElt`

is the same as`(:)`

why can’t we eta reduce

`extendList`

? can you find a function in the standard library that would allow you to get rid of the explicit xs parameter?write

`addTwos`

with a section