
#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 bgamari): Note that the probability of seeing the issue increases markedly if `regroup` is defined as, {{{#!hs regroup :: (NFData a, Show a, Hashable a, Eq a, Ord a) => [(a, Int)] -> [(a, Int)] regroup xs0 = let xs = map (\(x,y) -> (x, y+1)) xs0 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' }}} It appears that elements are getting dropped from the list inspected by `fromListWith` (which is why the `(+1)` makes the issue easier to see: you won't notice if you drop a zero from a sum) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13615#comment:18 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler