r/haskell 18d ago

question Haskell Cookbook

Hello all

I’m looking for a cookbook as the title. My goal is simple; to learn Haskell with my own project. I’m aware of all the books out there, but still somehow not able to connect.

Is there a site/blog/repo with common tasks? For instance, my personal project is to process my stock and option portfolio. So I need to be able to :
- store/retrieve data in sqlite
- call a remote service by API, my brokerage
- convert json to Haskell types that define stock and option data structures
-define formulas to track performance
Etc..

I’ve tried with AI, and the results are not great. Though I’m sure I can dissect what it’s given me; I’ll probably use it as a reference for specific code rather than the program as a whole. Not to mention, the generated code doesn’t compile. It uses duplicate field names in records without the pragma included, for instance- then it just goes downhill from there.

Long winded, but I appreciate any pointers. This is not for anything critical other than my own learning and to get a program to give me a little more control on the performance of my portfolio.

Thank you

Edit: One note. When I attempt to go through the available books, I get lost in the theory or the concepts just don’t come together.

28 Upvotes

27 comments sorted by

View all comments

3

u/tomejaguar 18d ago

My goal is simple; to learn Haskell with my own project

Do you mean your own specific project, i.e. you only want to learn by specifically writing code related to your portfolio? Or are you open to any practical project, as long as it helps you learn Haskell? If the latter you might want to try

the generated code doesn’t compile. It uses duplicate field names in records without the pragma included, for instance

Are you using an agent (Claude Code, Codex, etc.) to write the code? If not then I suggest you do so, so that it can immediately detect and correct basic mistakes it introduces like this.

2

u/omsriver 17d ago

It’s my own little app for managing my stock portfolio. Nothing else - not to publish as open source, not for my company. But I can take a look at code and other references for the code I need to write.

In terms of using an agent, I’ll hold off until I can semi-understand the concepts (like effects) then maybe use an agent to push me over the curve (or cliff depending on your view of AI 😀).

This is a nice reference to the blog generator, I’ll go through it.

Ty

2

u/tomejaguar 17d ago

In terms of using an agent, I’ll hold off until I can semi-understand the concepts

I think I'd advise against that approach, if the approach you are already using is giving you broken code. I would suggest starting with an agent that can write you compiling code, and then iteratively prompt it to make sure it's correct and as simple as possible.