patch applied (ghc): GHCi debugger: added a new flag,
-fno-print-binding-contents
pepe
mnislaih at gmail.com
Thu Nov 15 05:56:41 EST 2007
An example is worth a thousand words. This is the kind of output we
get now at a breakpoint:
> Stopped at Setup.lhs:24:27-65
> _result :: IO () = _
> iff :: InstallFlags = _
> lbi ::
> LocalBuildInfo = LocalBuildInfo (InstallDirTemplates
> (Distribution.Simple.InstallDirs.PathTemplate [...])
>
> (Distribution.Simple.InstallDirs.PathTemplate [...]) ....)
> (Compiler GHC
> (PackageIdentifier ...) ....) _ _ ....
> pd :: Distribution.PackageDescription.PackageDescription = _
> uh :: UserHooks = UserHooks _ _ [] [] ....
>
I declare this good enough™
For reference, this is what you get if you print lbi at this point:
>
>
> [Setup.lhs:24:27-65] *Main> :p lbi
> lbi = LocalBuildInfo (InstallDirTemplates
> (Distribution.Simple.InstallDirs.PathTemplate
> [Distribution.Simple.InstallDirs.Ordinary (_t1::FilePath)])
>
> (Distribution.Simple.InstallDirs.PathTemplate
> [Distribution.Simple.InstallDirs.Variable PrefixVar,
> Distribution
> .Simple.InstallDirs.Ordinary (_t2::FilePath)])
>
> (Distribution.Simple.InstallDirs.PathTemplate
> [Distribution.Simple.InstallDirs.Variable PrefixVar,
> Distribution
> .Simple.InstallDirs.Ordinary (_t3::FilePath)])
>
> (Distribution.Simple.InstallDirs.PathTemplate
> [Distribution.Simple.InstallDirs.Variable PkgIdVar,
> Distribution
> .Simple.InstallDirs.Ordinary (_t4::FilePath),
> Distribution
> .Simple.InstallDirs.Variable CompilerVar])
>
> (Distribution.Simple.InstallDirs.PathTemplate
> [Distribution.Simple.InstallDirs.Variable PrefixVar,
> Distribution
> .Simple.InstallDirs.Ordinary (_t5::FilePath)])
>
> (Distribution.Simple.InstallDirs.PathTemplate
> [Distribution.Simple.InstallDirs.Variable LibDirVar,
> Distribution
> .Simple.InstallDirs.Ordinary (_t6::FilePath)])
>
> (Distribution.Simple.InstallDirs.PathTemplate
> [Distribution.Simple.InstallDirs.Variable LibDirVar,
> Distribution
> .Simple.InstallDirs.Ordinary (_t7::FilePath),
> Distribution
> .Simple.InstallDirs.Variable LibSubdirVar,
> Distribution
> .Simple.InstallDirs.Ordinary (_t8::FilePath)])
>
> (Distribution.Simple.InstallDirs.PathTemplate
> [Distribution.Simple.InstallDirs.Variable PrefixVar,
> Distribution
> .Simple.InstallDirs.Ordinary (_t9::FilePath)])
>
> (Distribution.Simple.InstallDirs.PathTemplate
> [Distribution.Simple.InstallDirs.Variable PkgIdVar])
>
> (Distribution.Simple.InstallDirs.PathTemplate
> [Distribution.Simple.InstallDirs.Variable DataDirVar,
> Distribution
> .Simple.InstallDirs.Ordinary (_t10::FilePath),
> Distribution
> .Simple.InstallDirs.Variable PkgIdVar])
>
> (Distribution.Simple.InstallDirs.PathTemplate
> [Distribution.Simple.InstallDirs.Variable DocDirVar,
> Distribution
> .Simple.InstallDirs.Ordinary (_t11::FilePath)])
>
> (Distribution.Simple.InstallDirs.PathTemplate
> [Distribution.Simple.InstallDirs.Variable DocDirVar,
> Distribution
> .Simple.InstallDirs.Ordinary (_t12::FilePath)]))
> (Compiler GHC
> (PackageIdentifier (_t13::String)
> (Version
> [(_t14::Int),(_t15::Int),(_t16::Int)] []))
> [(CPP,(_t17::Flag)),(PatternGuards,
> (_t18::Flag)),(MagicHash,(_t19::Flag)),
> (PolymorphicComponents,(_t20::Flag)),
> (ExistentialQuantification,(_t21::Flag)),
> (KindSignatures,(_t22::Flag)),
> (EmptyDataDecls,(_t23::Flag)),
> (ParallelListComp,(_t24::Flag)),
> (ForeignFunctionInterface,(_t25::Flag)),
> (Rank2Types,(_t26::Flag)),
> (RankNTypes,(_t27::Flag)),(RecursiveDo,(_t28::Flag)),
> (Arrows,(_t29::Flag)),
> (TemplateHaskell,(_t30::Flag)),(Generics,(_t31::Flag)),
> (NoImplicitPrelude,(_t32::Flag)),
> (TypeFamilies,(_t33::Flag)),
> (BangPatterns,(_t34::Flag)),
> (NoMonomorphismRestriction,(_t35::Flag)),
> (ImplicitParams,(_t36::Flag)),
> (ScopedTypeVariables,(_t37::Flag)),
> (StandaloneDeriving,(_t38::Flag)),
> (TypeSynonymInstances,(_t39::Flag)),
> (FlexibleContexts,(_t40::Flag)),
> (FlexibleInstances,(_t41::Flag)),
> (MultiParamTypeClasses,(_t42::Flag)),
> (FunctionalDependencies,(_t43::Flag)),
> (GeneralizedNewtypeDeriving,
> (_t44::Flag)),(OverlappingInstances,(_t45::Flag)),
> (UndecidableInstances,(_t46::Flag)),
> (IncoherentInstances,(_t47::Flag))])
> (_t48::FilePath) (_t49::FilePath)
> [PackageIdentifier (_t50::String)
> (Version [(_t51::Int),
> (_t52::Int),(_t53::Int),(_t54::Int)] []),
> PackageIdentifier (_t55::String)
> (Version [(_t56::Int),
> (_t57::Int),(_t58::Int)] []),
> PackageIdentifier (_t59::String)
> (Version [(_t60::Int),
> (_t61::Int),(_t62::Int),(_t63::Int)] []),
> PackageIdentifier (_t64::String)
> (Version [(_t65::Int),
> (_t66::Int),(_t67::Int),(_t68::Int)] []),
> PackageIdentifier (_t69::String)
> (Version [(_t70::Int),
> (_t71::Int),(_t72::Int),(_t73::Int)] []),
> PackageIdentifier (_t74::String)
> (Version [(_t75::Int),
> (_t76::Int),(_t77::Int),(_t78::Int)] []),
> PackageIdentifier (_t79::String)
> (Version [(_t80::Int),
> (_t81::Int),(_t82::Int),(_t83::Int)] []),
> PackageIdentifier (_t84::String)
> (Version [(_t85::Int),
> (_t86::Int),(_t87::Int),(_t88::Int)] []),
> PackageIdentifier (_t89::String)
> (Version [(_t90::Int),
> (_t91::Int),(_t92::Int),(_t93::Int)] []),
> PackageIdentifier (_t94::String)
> (Version [(_t95::Int),
> (_t96::Int),(_t97::Int),(_t98::Int)] []),
> PackageIdentifier (_t99::String)
> (Version [(_t100::Int),
> (_t101::Int),(_t102::Int),(_t103::Int)] []),
> PackageIdentifier (_t104::String)
> (Version [(_t105::Int),
> (_t106::Int),(_t107::Int),(_t108::Int)] []),
> PackageIdentifier (_t109::String)
> (Version [(_t110::Int),
> (_t111::Int),(_t112::Int),(_t113::Int)] []),
> PackageIdentifier (_t114::String)
> (Version [(_t115::Int),
> (_t116::Int),(_t117::Int),(_t118::Int)] []),
> PackageIdentifier (_t119::String)
> (Version [(_t120::Int),
> (_t121::Int),(_t122::Int),(_t123::Int)] [])]
> (Just ['s','h','i','m','.','c','a','b','a','l'])
>
> (Distribution.PackageDescription.PackageDescription
> (PackageIdentifier (_t124::String)
> (Version
> [(_t125::Int),
> (_t126
> ::Int)]
> []))
> BSD3
> (_t127::FilePath) (_t128::String)
> (_t129
> ::String) (_t130::String) (_t131::String)
> [] (_t132
> ::String) (_t133::String)
> (_t134
> ::String) (_t135::String) (_t136::String)
> [Dependency
> (_t137::String) AnyVersion,
> Dependency
> (_t138::String) AnyVersion,
> Dependency
> (_t139::String) AnyVersion,
> Dependency
> (_t140::String) AnyVersion,
> Dependency
> (_t141::String) AnyVersion,
> Dependency
> (_t142::String) AnyVersion,
> Dependency
> (_t143::String)
> (UnionVersionRanges
> (ThisVersion (Version [(_t144::Int),
> (_t145
> ::Int)]
> []))
> (LaterVersion
> (Version [(_t146::Int),
> (_t147
> ::Int)]
> []))),
> Dependency
> (_t148::String) AnyVersion,
> Dependency
> (_t149::String) AnyVersion,
> Dependency
> (_t150::String) AnyVersion,
> Dependency
> (_t151::String) AnyVersion,
> Dependency
> (_t152::String) AnyVersion,
> Dependency
> (_t153::String) AnyVersion,
> Dependency
> (_t154::String) AnyVersion,
> Dependency
> (_t155::String)
> (UnionVersionRanges
> (ThisVersion (Version [(_t156::Int),
> (_t157
> ::Int),
> (_t158
> ::Int)]
> []))
> (LaterVersion
> (Version [(_t159::Int),
> (_t160
> ::Int),
> (_t161
> ::Int)]
> [])))]
> (UnionVersionRanges
> (ThisVersion (Version [(_t162::Int),
> (_t163
> ::Int)]
> []))
> (LaterVersion
> (Version [(_t164::Int),
> (_t165
> ::Int)]
> [])))
> Distribution
> .PackageDescription.Custom Nothing
> [Distribution
> .PackageDescription.Executable (_t166::String)
> (_t167
> ::FilePath)
> (Distribution
> .PackageDescription.BuildInfo True
> []
> []
> []
> []
> []
> []
> []
> [(_t168
> ::FilePath)]
> []
> []
> []
> []
> []
> []
> []
> [(GHC
> ,[(_t169::String)])]
> []
> []),
> Distribution
> .PackageDescription.Executable (_t170::String)
> (_t171
> ::FilePath)
> (Distribution
> .PackageDescription.BuildInfo True
> []
> []
> []
> []
> []
> []
> []
> [(_t172
> ::FilePath)]
> []
> []
> []
> []
> []
> []
> []
> [(GHC
> ,[(_t173::String),
> (_t174
> ::String)])]
> []
> [])]
> [(_t175
> ::FilePath)] [(_t176::FilePath)] [])
>
> (Distribution.Simple.Program.ProgramConfiguration Data.Map.Tip
> (_t177
> ::Distribution.Simple.Program.ConfiguredProgs))
> UserPackageDB True False False False True True
> False
> [Setup.lhs:24:27-65] *Main>
On 15/11/2007, at 10:55, pepe wrote:
> The bunch of patches I just pushed make use of the ppr_deeper
> primitives from Outputable, and now we cut the output at the
> depth(and width) given by opt_PprUserLength.
> I wasn't aware that this functionality was available in Outputable:
> it is quite amazing what one can do with these in a few lines of code!
> I have also improved some other bits of the Term pretty printer and
> am quite satisfied with the end result.
>
> Cheers
> pepe
>
> On 14/11/2007, at 10:48, Simon Marlow wrote:
>
>> All I meant was that we should use a more refined notion of "depth
>> limit" which does a good job of cutting off the output before it
>> grows too large. That might mean limiting not only the depth, but
>> the width too, for example.
>>
>> Cheers,
>> Simon
>>
>> pepe wrote:
>>> To clarify, this is only when doing ':show bindings', not when
>>> doing ':print'.
>>> Ensuring that the output given never gets too large would mean
>>> arbitrarily cutting it to make it fit, or giving the user some
>>> control over these settings. I remember talking to you about this
>>> in ICFP, and I got the impression you thought it was overkill. Did
>>> I misunderstand ?
>>> For now we have a shallow (fixed) depth limit in the term
>>> reconstruction step which helps to limit the size of terms, but
>>> unfortunately not the size of the output given by the pretty
>>> printer. I plan to experiment with Pretty.fullRender with well-
>>> chosen settings, that should be a big win. Any other suggestion
>>> will be very appreciated.
>>> pepe
>>> On 14/11/2007, at 10:17, Simon Marlow wrote:
>>>> Pepe Iborra wrote:
>>>>> Tue Nov 13 09:45:39 PST 2007 Pepe Iborra <mnislaih at gmail.com>
>>>>> * GHCi debugger: added a new flag, -fno-print-binding-contents
>>>>> The contents of bindings show at breakpoints and by :show
>>>>> bindings
>>>>> is rendered using the same printer that :print uses.
>>>>> But sometimes the output it gives spans over too many lines and
>>>>> the
>>>>> user may want to be able to disable it.
>>>>
>>>> Then wouldn't it be better to ensure that it never gets too
>>>> large? Or is that too hard?
>>>>
>>>> Cheers,
>>>> Simon
>>
>
More information about the Cvs-ghc
mailing list