summaryrefslogtreecommitdiff
path: root/testsuite/tests/perf/should_run/T15426.hs
blob: c85c7e7ec0f7db1e6b1da7558dd856ab6ac6a04d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import Control.Exception (evaluate)
import qualified Data.List as L

-- The following will fuse with minimal heap usage provided
-- `findIndices` is marked `INLINABLE` instead of `INLINE`.

unsafeFindIndex p = head . L.findIndices p

main = do evaluate $ L.elemIndex 999999 [(1::Int)..1000000]
          evaluate $ L.elemIndices 999999 [(1::Int)..1000000]
          evaluate $ L.findIndex (>=999999) [(1::Int)..1000000]
          evaluate $ L.findIndices (>=999999) [(1::Int)..1000000]
          evaluate $ unsafeFindIndex (>=999999) [(1::Int)..1000000]