3
votes
1answer
94 views

Crtitique my Haskell function 'capitalize'

I am a Haskell beginner. I wrote the following function that takes a string and returns a new string with each word capitalized: first letter uppercase, following letters lower-cased. It works, but I ...
1
vote
2answers
109 views

Haskell: rndFile and [Char] vs IO String error

import System.Environment (getArgs) import Random main = do args <- getArgs let len = length args let n = if len < 1 then 10000 else read (args !! 0) :: Int let fileName = if len < ...
3
votes
1answer
249 views

Optimizing ByteString escaping

I wrote a string escaping function in C, and I'm trying to rewrite it to Haskell. The C version, along with comments explaining why it does what it does, can be found on GitHub. Here's a naïve ...
6
votes
4answers
799 views

Approach to string split by character in Haskell

I'm trying to learn Haskell and the mindset of programming functionally. I have started off by trying to understand the basics by writing code without any Monads in it. So far, I think I'm getting ...