[GHC] #14367: Lazy evaluation can be invalidated

GHC ghc-devs at haskell.org
Wed Oct 18 16:06:32 UTC 2017


#14367: Lazy evaluation can be invalidated
-------------------------------------+-------------------------------------
        Reporter:  vanto             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  Other             |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by vanto):

 * status:  closed => new
 * resolution:  invalid =>


Comment:

 Replying to [[span(style=color: #FF0000, goldfire, second time )]]:\\
 I reopened this ticket for you to answer.\\
 What do you say about that?\\

 {{{
 Prelude> f True 6 (\x -> ('r'/'u'))

 <interactive>:4:18: error:
     * Could not deduce (Fractional Char) arising from a use of `/'
       from the context: Num p1
         bound by the inferred type of it :: Num p1 => p1
         at <interactive>:4:1-26
     * In the expression: ('r' / 'u')
       In the third argument of `f', namely `(\ x -> ('r' / 'u'))'
       In the expression: f True 6 (\ x -> ('r' / 'u'))
 }}}
 Who cares!
 the result must be 6 because of the lazy evaluation.\\
 And this:\\

 {{{
 Prelude> f True 6 (\x -> x+x)1

 <interactive>:8:1: error:
     * Non type-variable argument in the constraint: Num (t1 -> t2)
       (Use FlexibleContexts to permit this)
     * When checking the inferred type
         it :: forall t1 t2. (Num (t1 -> t2), Num t1) => t2
 }}}
 the result must be 6 because of the lazy evaluation too.\\
 But here, that run:\\

 {{{
 Prelude> f True 6 ((\x -> x+x)1)
 6
 }}}
 that does not make sense,it should not have an evaluation on the
 last expression taken into account. \\
 some result given by the compiler are '''not coherent,''' but however they
 are fair because GHC has been coded in this sense. '''Some priorities
 should be reversed,''' including lazy evaluation and errors. with -fdefer-
 typed-holes and -fdefer-out-of-scope-variables you answered the problem in
 part, but not in its entirety.\\
 take your time to think about that.\\
 do you understand this time?
 Thanks!

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


More information about the ghc-tickets mailing list