Fix #15738 by defining (and using) parenthesizeHsContext

Authored by RyanGlScott on Oct 15 2018, 12:49 PM.

Description

Fix Trac #15738 by defining (and using) parenthesizeHsContext

With QuantifiedConstraints, foralls can appear in more
nested positions than they could before, but Convert and the TH
pretty-printer were failing to take this into account. On the
Convert side, this is fixed by using a parenthesizeHsContext
to parenthesize singleton quantified constraints that appear to the
left of a =>. (A similar fix is applied to the TH pretty-printer.)

Test Plan: make test TEST=T15738

Reviewers: goldfire, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, carter

GHC Trac Issues: Trac #15738

Differential Revision: https://phabricator.haskell.org/D5222