Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View gist:3969348
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
module Main where
 
import Data.Word8 (Word8, _cr, _space, _tab, isAsciiLower)
import qualified Data.ByteString as B
 
isSpace ∷ Word8Bool
isSpace w = w == _space || w <= _cr && w >= _tab
 
toUpper ∷ Word8Word8
toUpper w = if isAsciiLower w then w - _space else w
 
op ∷ BoolWord8 → (Bool, Word8)
op flag c = if isSpace c then (True,c) else (False,d)
where d = if flag then toUpper c else c
 
main ∷ IO ()
main = B.readFile "input.txt" >>= B.putStr . snd . B.mapAccumL op True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.