Refactor hw to avoid "n+k" patterns

* https://ghc.haskell.org/trac/ghc/ticket/5572#comment:2
Simplify patterns with "_"
Simplify single element list pattern
Use pattern matching instead of fst/snd