| Copyright | Copyright (C) 2014 Joachim Breitner |
|---|---|
| License | BSD3 |
| Maintainer | Joachim Breitner <mail@joachim-breitner.de> |
| Stability | stable |
| Portability | GHCspecific |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Data.List.Fusion.Probe
Description
Synopsis
- fuseThis :: [a] -> [a]
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 $ foldr (+) 0 (fuseThis [0..1000])
will print 500500.
(These examples are from the time before GHC-7.10. Since then, foldl fuses as well.)