Skip to content

take (-1) [] fails

As described in the Haskell report, Prelude.take
applied to a negative argument and an empty list should
return an empty list. Hugs and HBC implements this
correctly, but GHC's implementation instead produces

  Exception: Prelude.take: negative index
I have two large programs, that work fine when compiled
with HBC, and fail because of this when compiled when
GHC. I have examined all direct calls to take in one of
them and I am 93.7% certain that they cannot be the
cause of the problem, so I suspect the offending call
to take comes from another prelude/library function...
Trac metadata
Trac field Value
Version 5.0
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution ResolvedFixed
Component Prelude
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information