on master help sign in
Show defined and automatically generated class instances in different blocks
commitbb25a8b7f45a2acef40cb7486ee90a28b83b398b authorPaul Koerbitz <paul.koerbitz@theppro.com> dateThu 1 May 2014, 10:28 (12 years ago) parent4168f05
1 file changed+9−4
src/Idris/Docs.hs+9−4
src/Idris/Docs.hs+9−4
@@ -84,10 +84,13 @@ pprintDocs imp (ClassDoc n doc meths params instances)
8484 nest 4 (text "Methods:" <$>
8585 vsep (map (pprintFD imp) meths))
8686 <$>
87− nest 4 (text "Instances:" <$>
88− let instances' = filter (not . hasConstraint) instances
89− in vsep (if null instances' then [text "<no instances>"]
90− else map dumpInstance instances'))
87+ nest 4 (text "Defined instances:" <$>
88+ vsep (if null definedInstances then [text "<no instances>"]
89+ else map dumpInstance definedInstances))
90+ <>
91+ if null generatedInstances then empty
92+ else line <$> nest 4 (text "Instances generated from subclasses:" <$>
93+ vsep (map dumpInstance generatedInstances))
9194 where
9295 params' = zip params (repeat False)
9396
@@ -98,6 +101,8 @@ pprintDocs imp (ClassDoc n doc meths params instances)
98101 hasConstraint (PPi _ _ _ pt) = hasConstraint pt
99102 hasConstraint _ = False
100103
104+ (generatedInstances, definedInstances) = partition hasConstraint instances
105+
101106getDocs :: Name -> Idris Docs
102107getDocs n
103108 = do i <- getIState