blob: 7b3ec2c603f533179cd0c0eb03a755fb7f1c4acf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
{-# LANGUAGE MagicHash, UnboxedTuples #-}
module Float where
import GHC.Prim
foo vs
= let w = if length (reverse vs) > 10 then Just (length vs) else Nothing
f :: State# RealWorld -> Int -> (# Int, State# RealWorld #)
f s x | Just 0 <- w = case f s (x+1) of
(# r, s' #) -> (# r, s' #)
| otherwise = (# x, s #)
in f realWorld# 1
|