1{-# LANGUAGE BangPatterns #-}
2module BangPatterns where
3
4firstnonspace :: Ptr Word8 -> Int -> Int -> IO Int
5firstnonspace !ptr !n !m
6    | n >= m    = return n
7    | otherwise = do w <- peekElemOff ptr n
8                     if isSpaceWord8 w then firstnonspace ptr (n+1) m else return n
9