Skip to content

improve documentation of -fdefer-typed-holes for naked expressions in ghci

Consider the following ghci session.

GHCi, version 8.2.1: http://www.haskell.org/ghc/  :? for help
Prelude> :set -fdefer-typed-holes -Wno-typed-holes
Prelude> :set -fdefer-out-of-scope-variables -Wno-deferred-out-of-scope-variables
Prelude> let x = [_]; y = [r]
Prelude> (length x, length y)
(1,1)
Prelude> length [_]

<interactive>:4:9: error:
    • Found hole: _ :: a0
      Where: ‘a0’ is an ambiguous type variable
    • In the expression: _
      In the first argument of ‘length’, namely ‘[_]’
      In the expression: length [_]
    • Relevant bindings include it :: Int (bound at <interactive>:4:1)
Prelude> length [r]
1

Why does the length [_] expression produce a type error immediately instead of being deferred?

~~(I've asked the same question in #14367 (closed) but this looks like a real bug.)~~

The documentation can be improved here, see [#ticket:14370#comment:144137 comment 2]

Edited by Bertram Felgenhauer
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information