Hot answers tagged

7

Prelude First of all, good work! I can see the effort you put into grokking something so foreign, and I would like to commend you for it. I will be focusing on reviewing what I think you can improve, but don't let these critiques discourage you—all code can be improved, but not all code works. I'll be doing a combination of making general comments and ...


7

Even though module Main is implied when no header is given, I'd write it. return . read =<< getLine = read <$> getLine = fmap read getLine is a worse version of readLn. read <$> getLine is basically return (error msg) when the parse fails. This passes the bottoming value into the "pure" part of your code. readLn badstr crashes at ...


3

Prelude I think your code (sans bug) is fine. Your question is already a little nit-picky so my comments will mostly be nit-picks. I am not a Haskell expert either, so don't place too much authority in my comments. Evaluate them for yourself. My comments are in a somewhat arbitrary order, but I've organized them with headers. The section pertaining ...


2

The code looks fine. At a high level, I don't think it really makes sense to say that this code follows a particularly object-oriented or functional style, maybe because the application is too simple. The difference in this case is really more a matter of perspective. From an OOP point of view, maybe you see a type with a bunch of methods. That's okay. (It's ...


Only top voted, non community-wiki answers of a minimum length are eligible