Re: [GHC] #13615: Nondeterminism in ‘pure’ function w/ parallel evaluation & memo combinators

GHC ghc-devs at haskell.org
Thu Apr 27 00:23:10 UTC 2017


#13615: Nondeterminism in ‘pure’ function w/ parallel evaluation & memo combinators
-------------------------------------+-------------------------------------
        Reporter:  pacak             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:  8.2.1
       Component:  Compiler          |              Version:  8.2.1-rc2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect result  |  Unknown/Multiple
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by pacak):

 I've confirmed that ghc has an interesting sense of equality:

 {{{
 regroup :: (NFData a, Show a, Hashable a, Eq a, Ord a) => [(a, Int)] ->
 [(a, Int)]
 regroup xs =
     let xs' = HM.toList $ HM.fromListWith (+) xs
         s' = sum (map snd xs')
         s  = sum (map snd xs)
      in if s' /= s
             then if show s' == show s
                     then error "WAT????"
                     else error $ "Those are expected to be equal" ++ show
 (s', s)
             else xs'
 }}}


 {{{
 gamebooksolver-solvebook02: Those are expected to be equal(141,121)
 CallStack (from HasCallStack):
   error, called at src/Main.hs:50:26 in main:Main
 gamebooksolver-solvebook02: Those are expected to be equal(384,300)
 CallStack (from HasCallStack):
   error, called at src/Main.hs:50:26 in main:Main
 gamebooksolver-solvebook02: Those are expected to be equal(1045,1045)
 CallStack (from HasCallStack):
   error, called at src/Main.hs:50:26 in main:Main
 gamebooksolver-solvebook02: WAT????
 CallStack (from HasCallStack):
   error, called at src/Main.hs:49:26 in main:Main
 gamebooksolver-solvebook02: WAT????
 CallStack (from HasCallStack):
   error, called at src/Main.hs:49:26 in main:Main
 gamebooksolver-solvebook02: WAT????
 CallStack (from HasCallStack):
   error, called at src/Main.hs:49:26 in main:Main
 }}}

 Actually it's even worse, note third error.

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


More information about the ghc-tickets mailing list