diff --git a/haskell-debugger/GHC/Debugger/Stopped/Variables.hs b/haskell-debugger/GHC/Debugger/Stopped/Variables.hs index d25ee1d..06c640d 100644 --- a/haskell-debugger/GHC/Debugger/Stopped/Variables.hs +++ b/haskell-debugger/GHC/Debugger/Stopped/Variables.hs @@ -131,9 +131,7 @@ termToVarInfo key term0 = do -- We only want to return @SpecificVariable@ (which allows expansion) for -- values with sub-fields or thunks. varRef <- do - if GHCI.isFullyEvaluatedTerm term || - -- Even if it is already evaluated, we do want to display a - -- structure as long if it is not a "boring type" (one that does not + if -- Display a structure as long it is not a "boring type" (one that does not -- provide useful information from being expanded) -- (e.g. consider how awkward it is to expand Char# 10 and I# 20) (not isThunk && (isBoringTy ty || not (hasDirectSubTerms term))) diff --git a/test/integration-tests/data/T110/T110.hs b/test/integration-tests/data/T110/T110.hs new file mode 100644 index 0000000..89eedc2 --- /dev/null +++ b/test/integration-tests/data/T110/T110.hs @@ -0,0 +1,11 @@ +module Main where + +data T = T !Int !Int + deriving Show + +main = do + y (T 333 34) + +y :: T -> IO () +y t = do + print t diff --git a/test/integration-tests/test/adapter.test.ts b/test/integration-tests/test/adapter.test.ts index 58d7709..4a027af 100644 --- a/test/integration-tests/test/adapter.test.ts +++ b/test/integration-tests/test/adapter.test.ts @@ -604,6 +604,28 @@ describe("Debug Adapter Tests", function () { const m2 = await getMutVarValue() assert.strictEqual(m2.value, "True") }) + + it('inspect fully evaluated type (issue #110)', async () => { + let config = mkConfig({ + projectRoot: "/data/T110", + entryFile: "T110.hs", + entryPoint: "main", + entryArgs: [], + extraGhcArgs: [] + }) + + const expected = { path: config.projectRoot + "/" + config.entryFile, line: 11 } + await dc.hitBreakpoint(config, { path: config.entryFile, line: 11 }, expected, expected); + + let locals = await fetchLocalVars(); + const tVar = await forceLazy(locals.get('t')); + assert.strictEqual(tVar.value, "T") + const tChild = await expandVar(tVar); // No force needed, is fully evaluated and can expand + const _1Var = await tChild.get('_1'); + const _2Var = await tChild.get('_2'); + assert.strictEqual(_1Var.value, '333'); + assert.strictEqual(_2Var.value, '34'); + }) }) describe("Stepping out (step-out)", function () {