#80: A curious stack overflow problem --------------------+------------------------------------------------------- Reporter: guest | Owner: nobody Type: defect | Status: new Priority: major | Milestone: Component: hugs | Version: 200609 Keywords: | --------------------+------------------------------------------------------- Suppose I define
natmin :: [Int] -> Int natmin = foldr1 min where min x y = if x==0 || x<=y then x else y
I would expect the same behaviour from natmin ([1..10000] ++ [0..]) as from or ([False | i <- [1..10000]] ++ [True | i <- [1..]]) But the first gives stack overflow, and the second doesn't. The problem does not exist with GHCi. Richard Bird bird@comlab.ox.ac.uk -- Ticket URL: http://hackage.haskell.org/trac/hugs/ticket/80 Hugs http://www.haskell.org/hugs/ Hugs 98, an interpreter for Haskell
#80: A curious stack overflow problem ----------------------+----------------------------------------------------- Reporter: guest | Owner: nobody Type: defect | Status: closed Priority: major | Milestone: Component: hugs | Version: 200609 Resolution: invalid | Keywords: ----------------------+----------------------------------------------------- Changes (by ross): * status: new => closed * resolution: => invalid Comment: The behaviour is standard outermost evaluation, driven by the different properties of min and (||). The same thing happens with ghci, if you make the first list a bit longer. (The infinite lists make no difference: singleton lists [1] or [True] give the same effect.) -- Ticket URL: http://hackage.haskell.org/trac/hugs/ticket/80#comment:1 Hugs http://www.haskell.org/hugs/ Hugs 98, an interpreter for Haskell
participants (1)
-
Hugs