Fix: no-unused-expressions directive support (fixes #1185)

Fixes #1185. Related: #1186.
But the function is more generically applicable. See [`takeWhile`'s signature](http://hackage.haskell.org/package/base-4.7.0.1/docs/Prelude.html#v:takeWhile).