
#14370: improve documentation of -fdefer-typed-holes for naked expressions in ghci -------------------------------------+------------------------------------- Reporter: int-e | Owner: (none) Type: task | Status: new Priority: normal | Milestone: Component: Documentation | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by int-e): * type: bug => task * component: Compiler => Documentation Old description:
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 but this looks like a real bug.)
New description: 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 but this looks like a real bug.)~~ The documentation can be improved here, see [#comment:2 comment 2] -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14370#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler