Skip to content
Snippets Groups Projects
Commit 384577e8 authored by Alec Theriault's avatar Alec Theriault
Browse files

Fix #1063 with better parenthesization logic for contexts

The only other change in html/hoogle/hyperlinker output for the boot
libraries that this caused is a fix to some Hoogle output for implicit
params.

```
$ diff -r _build/docs/ old_docs
diff -r _build/docs/html/libraries/base/base.txt old_docs/html/libraries/base/base.txt
13296c13296
< assertError :: (?callStack :: CallStack) => Bool -> a -> a
---
> assertError :: ?callStack :: CallStack => Bool -> a -> a
```
parent b4c2b90d
No related branches found
No related tags found
No related merge requests found
......@@ -275,11 +275,13 @@ reparenTypePrec = go
go p (HsKindSig x ty kind)
= paren p PREC_SIG $ HsKindSig x (goL PREC_SIG ty) (goL PREC_SIG kind)
go p (HsIParamTy x n ty)
= paren p PREC_CTX $ HsIParamTy x n (reparenLType ty)
= paren p PREC_SIG $ HsIParamTy x n (reparenLType ty)
go p (HsForAllTy x tvs ty)
= paren p PREC_CTX $ HsForAllTy x (map (fmap reparenTyVar) tvs) (reparenLType ty)
go p (HsQualTy x ctxt ty)
= paren p PREC_FUN $ HsQualTy x (fmap (map reparenLType) ctxt) (reparenLType ty)
= let p' [_] = PREC_CTX
p' _ = PREC_TOP -- parens will get added anyways later...
in paren p PREC_CTX $ HsQualTy x (fmap (\xs -> map (goL (p' xs)) xs) ctxt) (goL PREC_TOP ty)
go p (HsFunTy x ty1 ty2)
= paren p PREC_FUN $ HsFunTy x (goL PREC_FUN ty1) (goL PREC_TOP ty2)
go p (HsAppTy x fun_ty arg_ty)
......
<html xmlns="http://www.w3.org/1999/xhtml"
><head
><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
/><meta name="viewport" content="width=device-width, initial-scale=1"
/><title
>Bug1063</title
><link href="#" rel="stylesheet" type="text/css" title="Linuwial"
/><link rel="stylesheet" type="text/css" href="#"
/><link rel="stylesheet" type="text/css" href="#"
/><script src="haddock-bundle.min.js" async="async" type="text/javascript"
></script
><script type="text/x-mathjax-config"
>MathJax.Hub.Config({ tex2jax: { processClass: &quot;mathjax&quot;, ignoreClass: &quot;.*&quot; } });</script
><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"
></script
></head
><body
><div id="package-header"
><span class="caption empty"
></span
><ul class="links" id="page-menu"
><li
><a href="#"
>Contents</a
></li
><li
><a href="#"
>Index</a
></li
></ul
></div
><div id="content"
><div id="module-header"
><table class="info"
><tr
><th
>Safe Haskell</th
><td
>Safe</td
></tr
></table
><p class="caption"
>Bug1063</p
></div
><div id="interface"
><h1
>Documentation</h1
><div class="top"
><p class="src"
><span class="keyword"
>class</span
> (c =&gt; d) =&gt; <a id="t:Implies" class="def"
>Implies</a
> c d <a href="#" class="selflink"
>#</a
></p
><div class="subs instances"
><h4 class="instances details-toggle-control details-toggle" data-details-id="i:Implies"
>Instances</h4
><details id="i:Implies" open="open"
><summary class="hide-when-js-enabled"
>Instances details</summary
><table
><tr
><td class="src clearfix"
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:ic:Implies:Implies:1"
></span
> (c =&gt; d) =&gt; <a href="#" title="Bug1063"
>Implies</a
> c d</span
> <a href="#" class="selflink"
>#</a
></td
><td class="doc empty"
></td
></tr
><tr
><td colspan="2"
><details id="i:ic:Implies:Implies:1"
><summary class="hide-when-js-enabled"
>Instance details</summary
><p
>Defined in <a href="#"
>Bug1063</a
></p
></details
></td
></tr
></table
></details
></div
></div
></div
></div
><div id="footer"
></div
></body
></html
>
\ No newline at end of file
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE UndecidableInstances #-}
module Bug1063 where
class (c => d) => Implies c d
instance (c => d) => Implies c d
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment