blob: de88c28ce001a1ede19b7d3dbf81fc7347d20747 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import Control.Exception (evaluate)
import Data.List
-- The following will fuse with minimal heap usage provided
-- `findIndices` is marked `INLINABLE` instead of `INLINE`.
unsafeFindIndex p = head . findIndices p
main = do evaluate $ elemIndex 999999 [(1::Int)..1000000]
evaluate $ elemIndices 999999 [(1::Int)..1000000]
evaluate $ findIndex (>=999999) [(1::Int)..1000000]
evaluate $ findIndices (>=999999) [(1::Int)..1000000]
evaluate $ unsafeFindIndex (>=999999) [(1::Int)..1000000]
|