on master help sign in
Show type class parameters in :i
860cdc0David Raymond Christiansen
src/Idris/REPL.hs+13−6
@@ -13,7 +13,7 @@ import Idris.ErrReverse
13import Idris.Delaborate
13import Idris.Delaborate
14import Idris.Docstrings (Docstring, overview, renderDocstring)
14import Idris.Docstrings (Docstring, overview, renderDocstring)
15import Idris.Prover
15import Idris.Prover
16−import Idris.Parser
16+import Idris.Parser hiding (indent)
17import Idris.Primitives
17import Idris.Primitives
18import Idris.Coverage
18import Idris.Coverage
19import Idris.UnusedArgs
19import Idris.UnusedArgs
@@ -998,19 +998,26 @@ classInfo :: ClassInfo -> Idris (Doc OutputAnnotation)
998classInfo ci = do ist <- getIState
998classInfo ci = do ist <- getIState
999 ctxt <- getContext
999 ctxt <- getContext
1000 return $
1000 return $
1001+ text "Parameters:" <+>
1002+ hsep (punctuate comma (map (prettyName False params') params)) <>
1003+ line <> line <>
1001 text "Methods:" <> line <>
1004 text "Methods:" <> line <>
1002− vsep (map (dumpMethod ist) (class_methods ci)) <> line <> line <>
1005+ indent 2 (vsep (map (dumpMethod ist) (class_methods ci))) <> line <> line <>
1003− text "Default superclass instances:" <> line <>
1006+ text "Default superclass instances:" <>
1007+ line <>
1004− vsep (map (dumpDefaultInstance ist) (class_default_superclasses ci)) <> line <>
1008+ indent 2 (vsep (map (dumpDefaultInstance ist) (class_default_superclasses ci))) <>
1009+ line <>
1005 text "Instances:" <> line <>
1010 text "Instances:" <> line <>
1006− vsep (map (dumpInstance ist ctxt) (class_instances ci))
1011+ indent 2 (vsep (map (dumpInstance ist ctxt) (class_instances ci)))
1007 where dumpMethod :: IState -> (Name, (FnOpts, PTerm)) -> Doc OutputAnnotation
1012 where dumpMethod :: IState -> (Name, (FnOpts, PTerm)) -> Doc OutputAnnotation
1008 dumpMethod ist (n, (_, t)) = prettyName False [] n <+> colon <+> pp ist t
1013 dumpMethod ist (n, (_, t)) = prettyName False [] n <+> colon <+> pp ist t
1009 dumpDefaultInstance :: IState -> PDecl -> Doc OutputAnnotation
1014 dumpDefaultInstance :: IState -> PDecl -> Doc OutputAnnotation
1010 dumpDefaultInstance ist (PInstance _ _ _ _ _ t _ _) = pp ist t
1015 dumpDefaultInstance ist (PInstance _ _ _ _ _ t _ _) = pp ist t
1011 dumpInstance :: IState -> Context -> Name -> Doc OutputAnnotation
1016 dumpInstance :: IState -> Context -> Name -> Doc OutputAnnotation
1012 dumpInstance ist ctxt n = pp ist $ delabTy ist n
1017 dumpInstance ist ctxt n = pp ist $ delabTy ist n
1018+ params = class_params ci
1019+ params' = zip params (repeat False)
1013− pp ist = prettyImp (opt_showimp (idris_options ist))
1020+ pp ist = pprintPTerm (opt_showimp (idris_options ist)) params' []
1014
1021
1015showTotal :: Totality -> IState -> String
1022showTotal :: Totality -> IState -> String
1016showTotal t@(Partial (Other ns)) i
1023showTotal t@(Partial (Other ns)) i