Let's consider some basics:
Prelude> lst = [[1, 2], [6], [8, 9]]
Prelude> map head lst
[1,6,8]
Prelude> sum (map head lst)
15
Now, let's make a function:
Prelude> sumFstElems lst = sum (map head lst)
Prelude> sumFstElems lst
15
But what if we use . to compose the functions sum and map head, and then apply that to the lst argument?
Prelude> sumFstElems lst = (sum . map head) lst
Prelude> sumFstElems lst
15
That works. But then we don't need to explicitly list the argument.
Prelude> sumFstElems = sum . map head
Prelude> sumFstElems lst
15
Of course, this will fail if any of the lists contained in lst are empty. Given that this is possible, maybe we should filter those out.
Prelude> sumFstElems = sum . map head . filter (/= [])
Prelude> sumFstElems [[1, 2], [6], [8, 9], [], [4]]
19
A list comprehension provides a way of combining the filtering and mapping.
Prelude> sumFstElems lst = sum [head x | x <- lst, x /= []]
Prelude> sumFstElems [[1, 2], [6], [8, 9], [], [4]]
19
sumFstElems [[]]return?