splitAt does not implement H98 report behaviour, it is too strict in 'n'
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 GHC's implementation is strict in 'n', that is:
split _|_ xs = _|_
These cases can be distinguished with the expression:
case splitAt undefined [] of (_,_) -> ()
Hugs has the same problem. It defines splitAt by:
splitAt n xs | n <= 0 = ([],xs)
splitAt _ [] = ([],[])
splitAt n (x:xs) = (x:xs',xs'') where (xs',xs'') = splitAt (n-1) xs
Perhaps for Haskell' we should make the report a little more lenient?
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.6 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | libraries/haskell98 |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | Multiple |
| Architecture | Multiple |