Skip to content

splitAt should be strict in its first argument

The below is a slightly editted version of http://hackage.haskell.org/trac/ghc/ticket/1182


The H98 report defines splitAt by:

splitAt :: Int -> [a] -> ([a],[a])
splitAt n xs = (take n xs, drop n xs)

So we would expect:

splitAt _|_ xs = (take _|_ xs, drop _|_ xs)

however, both GHC and hugs have (different) implementations that are strict in 'n', that is:

split _|_ xs = _|_

These cases can be distinguished with the expression:

case splitAt undefined [] of (_,_) -> ()

We propose splitAt be changed to be strict in its first argument for Haskell'.

Trac metadata
Trac field Value
Version
Type Task
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component HaskellPrime
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