on master help sign in
Correct filtering for subclasses in pprintDocs (fixes #1212)
commit671719e2581bfefceea5d76a9ec61457efce240b authorPaul Koerbitz <paul.koerbitz@theppro.com> dateSun 11 May 2014, 13:02 (12 years ago) parent22143e4
1 file changed+7−4
src/Idris/Docs.hs+7−4
src/Idris/Docs.hs+7−4
@@ -123,11 +123,14 @@ pprintDocs ist (ClassDoc n doc meths params instances superclasses)
123123 updateRef nm (PRef fc _) = PRef fc nm
124124 updateRef _ pt = pt
125125
126− hasConstraint (PPi (Constraint _ _) _ _ _) = True
127− hasConstraint (PPi _ _ _ pt) = hasConstraint pt
128− hasConstraint _ = False
126+ isSubclass (PPi (Constraint _ _) _ _ (PApp _ (PRef _ nm) ((PExp _ _ _ tm):_))) = nm == n && not (isApp tm)
127+ isSubclass (PPi _ _ _ pt) = isSubclass pt
128+ isSubclass _ = False
129129
130− (subclasses, instances') = partition hasConstraint instances
130+ isApp (PApp _ _ _) = True
131+ isApp _ = False
132+
133+ (subclasses, instances') = partition isSubclass instances
131134
132135 prettyParameters = if any (isJust . snd) params
133136 then vsep (map (\(nm,md) -> prettyName False params' nm <+> maybe empty showDoc md) params)