summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci/scripts/T7939.stdout
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2018-11-26 12:59:09 -0500
committerRyan Scott <ryan.gl.scott@gmail.com>2018-11-26 12:59:11 -0500
commitf932b1aa42f45625658c8abaf862cc570507c5ca (patch)
tree0755ee1ce530f0afee8a6b5ec44f22e53eee3cc5 /testsuite/tests/ghci/scripts/T7939.stdout
parentdf570d920fa66db631f936fa377e598fe92bd2a1 (diff)
downloadhaskell-f932b1aa42f45625658c8abaf862cc570507c5ca.tar.gz
Print explicit foralls in type family eqns when appropriate
Summary: When `-fprint-explicit-foralls` is enabled, type family equations are either printed without an explict `forall` entirely, or with a bizarre square bracket syntax (in the case of closed type families). I find neither satisfying, so in this patch, I introduce support for printing explicit `forall`s in open type-family, closed type-family, and data-family equations when appropriate. (By "when appropriate", I refer to the conditions laid out in `Note [When to print foralls]` in `IfaceType`.) One tricky point in the implementation is that I had to pick a visibility for each type variable in a `CoAxiom`/`FamInst` in order to be able to pass it to `pprUserIfaceForAll` //et al.// Because the type variables in a type family instance equation can't be instantiated by the programmer anyway, the choice only really matters for pretty-printing purposes, so I simply went with good ol' trustworthy `Specified`. (This design choice is documented in `Note [Printing foralls in type family instances]` in `IfaceType`.) Test Plan: make test TEST=T15827 Reviewers: goldfire, bgamari, simonpj Reviewed By: simonpj Subscribers: simonpj, rwbarton, carter GHC Trac Issues: #15827 Differential Revision: https://phabricator.haskell.org/D5282
Diffstat (limited to 'testsuite/tests/ghci/scripts/T7939.stdout')
-rw-r--r--testsuite/tests/ghci/scripts/T7939.stdout22
1 files changed, 10 insertions, 12 deletions
diff --git a/testsuite/tests/ghci/scripts/T7939.stdout b/testsuite/tests/ghci/scripts/T7939.stdout
index 82a8658906..4c2a602f4f 100644
--- a/testsuite/tests/ghci/scripts/T7939.stdout
+++ b/testsuite/tests/ghci/scripts/T7939.stdout
@@ -5,23 +5,21 @@ Bar :: k -> * -> *
type family F a :: * -- Defined at T7939.hs:8:1
type instance F Int = Bool -- Defined at T7939.hs:9:15
F :: * -> *
-type family G a :: *
- where G Int = Bool
+type family G a :: * where
+ G Int = Bool
-- Defined at T7939.hs:11:1
G :: * -> *
-type family H (a :: Bool) :: Bool
- where H 'False = 'True
+type family H (a :: Bool) :: Bool where
+ H 'False = 'True
-- Defined at T7939.hs:14:1
H :: Bool -> Bool
-type family J (a :: [k]) :: Bool
- where
- J '[] = 'False
- J (h : t) = 'True
+type family J (a :: [k]) :: Bool where
+ J '[] = 'False
+ forall k (h :: k) (t :: [k]). J (h : t) = 'True
-- Defined at T7939.hs:17:1
J :: [k] -> Bool
-type family K (a1 :: [a]) :: Maybe a
- where
- K '[] = 'Nothing
- K (h : t) = 'Just h
+type family K (a1 :: [a]) :: Maybe a where
+ K '[] = 'Nothing
+ forall a (h :: a) (t :: [a]). K (h : t) = 'Just h
-- Defined at T7939.hs:21:1
K :: [a] -> Maybe a