Opened 13 years ago

Last modified 4 years ago

#119 new task

splitAt should be strict in its first argument

Reported by: Ian Lynagh Owned by: none
Priority: normal Milestone:
Version: Keywords:
Cc: Meta Owner:
State: discussion Section: N/A or multiple
Related Tickets:

Description

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'.

Change History (3)

comment:1 Changed 13 years ago by Ian Lynagh

component: HaskellPrimeProposal
Owner: changed from ijones to none

comment:2 Changed 4 years ago by Herbert Valerio Riedel

Milestone:

moving non-milestoned many year old legacy tickets out of the way

comment:3 Changed 4 years ago by Herbert Valerio Riedel

Priority: minornormal

Set default priority (as this confuses Trac otherwise)

Note: See TracTickets for help on using tickets.