Make sure GHC.List.last is memory-efficient
authorJoachim Breitner <mail@joachim-breitner.de>
Thu, 16 Apr 2015 12:49:23 +0000 (14:49 +0200)
committerJoachim Breitner <mail@joachim-breitner.de>
Fri, 24 Apr 2015 09:14:26 +0000 (11:14 +0200)
commit524ddbdad5816f77b7b719cac0671eebd3473616
treeeae3d5c159b64643b381ac37907ef26f827865c9
parenta55bfabbed21f17064f863450f9d94d45db9c478
Make sure GHC.List.last is memory-efficient

by eta-expanding its definition so that GHC optmizes the foldl here.
Also make sure that other uses of last go via foldl as well, to allow
list fusion (tested in T9339). Fixes #10260.
libraries/base/GHC/List.hs