list-fusion-probe-0.1: testing list fusion for success

PortabilityGHCspecific
Stabilitystable
MaintainerJoachim Breitner <mail@joachim-breitner.de>
Safe HaskellNone

Data.List.Fusion.Probe

Description

 

Synopsis

Documentation

fuseThis :: [a] -> [a]Source

This function can be wrapped around a list that should be compiled away by list fusion. If it does, this function will disappear. If not, it will throw an error at runtime.

 main = print $ foldl (+) 0 (fuseThis [0..1000])

Will print Test: fuseList: List did not fuse, while

 main = print $ foldl (+) 0 (fuseThis [0..1000])

will print 500500.