Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Main where
- import Data.Word
- import qualified Data.ByteString as X
- convert :: X.ByteString -> X.ByteString
- convert = X.tail . X.scanl (\a b -> if isSpace a then toUpper b else b) 32
- isSpace :: Word8 -> Bool
- isSpace w = if w == 32 || w == 10 then True else False
- {-# INLINE isSpace #-}
- toUpper :: Word8 -> Word8
- toUpper w = if w > 96 && w < 123 then w - 32 else w
- {-# INLINE toUpper #-}
- main = do
- name <- X.readFile "file"
- X.putStr $ convert name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement