Newbie learning Haskell

I’m a newbie to Haskell, and yet to figure out what the actual deal is with monads.


I have written an accounting program using Haskell, which proves that it can be done even if your grip on the language is tenuous. The program is a little over 2000 lines long.

Parsing is something that’s always fascinating to mess around with. I had tried using some parser tech in Python, although I found it surprisingly difficult to use. I actually had more luck with lex and yacc in C.

It’s best to use a high-level language like Haskell. My accounting program actually used some fairly naive parsing based on splitting on whitespace.

Next, I wrote a statistics app that uses Parsec. Parsec is quite usable. I had tried the alex+happy combo, but I seemed to end up with a parser that didn’t terminate.

But now I’m back again, trying to create a simple lexer with Alex. It seems like a good idea to write the lexer before the parser as a completely separate exercise. You can then call scanAlexTokens to see how/if the lexer scans the input. At least you can get one half of the equation right.

My next project might be will be to write a DSL, in which I use the basics I have learned with Alex, and try to marry it with Happy. Hopefully this time I will be able to produce a parser that doesn’t seem to go around in an infinite loop. Writing DSLs is a lot of fun, so I’m looking to expand my knowledge of Haskell in this area.

I had a quick play again with Rust and Julia. I found that they aren’t stable enough for everyday use, though. Rust should be at 1.0 later this month. I think it will take a fair amount of time for third party libraries to be compatible, though, as I found to my cost. Danluu wrote an interesting blog article, Julia Is Awesome, But … ,  pointing out what he feels is some basic problems with the language/implementation. I haven’t used Julia that intently, so haven’t run into the same bugs that he has, but I share his sentiments when he writes:

turning my plotting workflow into: restart REPL, wait 30 seconds, make a change, make a plot, look at a plot, repeat.

No doubt I will return to those languages again, but Haskell has the advantage that it is available now, and I find I’m getting more and more into it as a language.

About mcturra2000

Computer programmer living in Scotland.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s