#3981: Value of function differs for arguments of the same value
------------------------+---------------------------------------------------
    Reporter:  kirstin  |       Owner:                             
        Type:  bug      |      Status:  new                        
    Priority:  normal   |   Component:  Compiler                   
     Version:  6.12.1   |    Keywords:                             
          Os:  Linux    |    Testcase:                             
Architecture:  x86      |     Failure:  Incorrect result at runtime
------------------------+---------------------------------------------------

Comment(by batterseapower):

 I don't think this is a bug. When you type:

 {{{
 choose 15 2
 }}}

 By the defaulting rules for Num, you get a value of type Integer, which is
 able to hold the large intermediate values produced by choose.

 When you type:

 {{{
 choose (length x) 2
 }}}

 The fact that length always returns Int forces choose to return an Int,
 and the large intermediate values overflow the available bits.

 I guess it will work if you use:

 {{{
 import Data.List

 choose (genericLength x) 2
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3981#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to