[GHC] #14370: non-deferred typed hole despite -fdefer-typed-holes

GHC ghc-devs at haskell.org
Wed Oct 18 20:07:19 UTC 2017


#14370: non-deferred typed hole despite -fdefer-typed-holes
-------------------------------------+-------------------------------------
           Reporter:  int-e          |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.2.1
           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:
-------------------------------------+-------------------------------------
 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.)

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14370>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list