diff options
-rw-r--r-- | html-test/ref/DeprecatedClass.html | 16 | ||||
-rw-r--r-- | html-test/ref/Hash.html | 8 | ||||
-rw-r--r-- | html-test/ref/Test.html | 8 | ||||
-rw-r--r-- | html-test/ref/Ticket61.html | 8 | ||||
-rw-r--r-- | html-test/src/Minimal.hs | 40 | ||||
-rw-r--r-- | src/Haddock/Backends/Xhtml/Decl.hs | 7 |
6 files changed, 46 insertions, 41 deletions
diff --git a/html-test/ref/DeprecatedClass.html b/html-test/ref/DeprecatedClass.html index 76c0c173..c8799bf2 100644 --- a/html-test/ref/DeprecatedClass.html +++ b/html-test/ref/DeprecatedClass.html @@ -95,14 +95,6 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedClass.html") ><p >some class</p ></div - ><div class="subs minimal" - ><p class="caption" - >Minimal complete definition</p - ><p class="src" - ><a href="DeprecatedClass.html#v:foo" - >foo</a - ></p - ></div ><div class="subs methods" ><p class="caption" >Methods</p @@ -135,14 +127,6 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedClass.html") >Deprecated: SomeOtherClass</p ></div ></div - ><div class="subs minimal" - ><p class="caption" - >Minimal complete definition</p - ><p class="src" - ><a href="DeprecatedClass.html#v:bar" - >bar</a - ></p - ></div ><div class="subs methods" ><p class="caption" >Methods</p diff --git a/html-test/ref/Hash.html b/html-test/ref/Hash.html index e0abc7f6..eff422f7 100644 --- a/html-test/ref/Hash.html +++ b/html-test/ref/Hash.html @@ -250,14 +250,6 @@ window.onload = function () {pageLoad();setSynopsis("mini_Hash.html");}; ><p >A class of types which can be hashed.</p ></div - ><div class="subs minimal" - ><p class="caption" - >Minimal complete definition</p - ><p class="src" - ><a href="Hash.html#v:hash" - >hash</a - ></p - ></div ><div class="subs methods" ><p class="caption" >Methods</p diff --git a/html-test/ref/Test.html b/html-test/ref/Test.html index 5d738a54..fcad8657 100644 --- a/html-test/ref/Test.html +++ b/html-test/ref/Test.html @@ -1599,14 +1599,6 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; > a <span class="keyword" >where</span ></p - ><div class="subs minimal" - ><p class="caption" - >Minimal complete definition</p - ><p class="src" - ><a href="Test.html#v:ff" - >ff</a - ></p - ></div ><div class="subs methods" ><p class="caption" >Methods</p diff --git a/html-test/ref/Ticket61.html b/html-test/ref/Ticket61.html index bc0f0c0c..5a181e0c 100644 --- a/html-test/ref/Ticket61.html +++ b/html-test/ref/Ticket61.html @@ -53,14 +53,6 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket61.html");}; > a <span class="keyword" >where</span ></p - ><div class="subs minimal" - ><p class="caption" - >Minimal complete definition</p - ><p class="src" - ><a href="Ticket61.html#v:f" - >f</a - ></p - ></div ><div class="subs methods" ><p class="caption" >Methods</p diff --git a/html-test/src/Minimal.hs b/html-test/src/Minimal.hs new file mode 100644 index 00000000..cd2df930 --- /dev/null +++ b/html-test/src/Minimal.hs @@ -0,0 +1,40 @@ +-- | This tests the new MINIMAL pragma present in GHC 7.8 +module Minimal + ( Foo(..) + , Weird(..) + , NoMins(..) + , FullMin(..) + , PartialMin(ccc) + , EmptyMin(..) + ) where + +class Foo a where + -- | Any two of these are required... + foo, bar, bat :: a + + -- | .. or just this + fooBarBat :: (a,a,a) + + {-# MINIMAL (foo, bar) | (bar, bat) | (foo, bat) | fooBarBat #-} + +class Weird a where + a,b,c,d,e,f,g :: a + + {-# MINIMAL ((a, b), c | (d | (e, (f | g)))) #-} + +class NoMins a where + x,y,z :: a + + -- | Has a default implementation! + z = x + +class FullMin a where + aaa,bbb :: a + +class PartialMin a where + ccc,ddd :: a + +class EmptyMin a where + eee,fff :: a + eee = fff + fff = undefined diff --git a/src/Haddock/Backends/Xhtml/Decl.hs b/src/Haddock/Backends/Xhtml/Decl.hs index 39276441..67185bff 100644 --- a/src/Haddock/Backends/Xhtml/Decl.hs +++ b/src/Haddock/Backends/Xhtml/Decl.hs @@ -474,11 +474,16 @@ ppClassDecl summary links instances fixities loc d subdocs -- type signature? minimalBit = case [ s | L _ (MinimalSig s) <- lsigs ] of - -- Miminal complete definition = every method + -- Miminal complete definition = every shown method And xs : _ | sort [getName n | Var (L _ n) <- xs] == sort [getName n | L _ (TypeSig ns _) <- lsigs, L _ n <- ns] -> noHtml + -- Minimal complete definition = the only shown method + Var (L _ n) : _ | [getName n] == + [getName n' | L _ (TypeSig ns _) <- lsigs, L _ n' <- ns] + -> noHtml + -- Minimal complete definition = nothing And [] : _ -> subMinimal $ toHtml "Nothing" |