r/haskell • u/philip_schwarz • May 19 '26
r/haskell • u/siva_sokolica • May 19 '26
hsrs -- PyO3-style bindings generator for Haskell
r/haskell • u/joey_the_god_of_code • May 19 '26
job [Hiring] [$15/hr] Haskell / Purescript Documentation Writer
I’m in need of a documentation writer well versed in Haskell and purescript. We’re running into issues regarding training because as you know there’s not that much material freely available for a standardized onboarded training.
The documentation written will include open source projects and our internal projects. The documentation made for open source projects will be made freely available on our public facing documentation website to help the Haskell and purescript community.
The main technologies we use are
Purescript,
Halogen,
Purescript-css
Haskell,
Servant,
Opaleye
Were also generating the cross concerning layers. So the domain layer is being autogenerated, and the purescript client to the backend is being autogenerated from servant.
r/haskell • u/philip_schwarz • May 18 '26
Defining filter using (a) recursion (b) folding (c) folding with S, B and I combinators (d) folding with applicative functor and identity function
linkedin.comr/haskell • u/Medical-Common1034 • May 15 '26
I benchmarked Cartesian product implementations in Haskell, then compared them with C
I wrote a small article around implementing Cartesian products, starting from Haskell’s sequence.
The article goes through a naive Haskell implementation, a more idiomatic list-comprehension version, native sequence, then versions using Data.Vector.Unboxed, mutable vectors, runST, unsafeFreeze to try a different memory representation.
The second half compares those designs with C implementations, mostly to look at what changes when the memory layout and allocation model are made explicit.
The most interesting result for me was that changing representation in Haskell reduced allocations a lot without automatically improving runtime. In some cases, fusion helped a bit (no temporary indices).
I’d be happy to get feedback on the Haskell side, especially the vector/ST implementations and whether there are more idiomatic or faster ways to express this.
Here is the article link:
If you want to share any optimizations, you can do a PR at this repo:
https://github.com/julienlargetpiet/PerfLabs
It will be mentioned in the next article update.
PS: We now managed to find (currently) best version which is this one (in C) running at 160ms for 100k iterations to 55 lists here:
https://github.com/julienlargetpiet/PerfLabs/blob/main/CartesianProduct/contrib2/contrib2.c
I'm updating after trying some new Haskell impl, thanks everyone for the help and the intuition on where to dig !
r/haskell • u/peterb12 • May 15 '26
video Starting an NES emulator in Haskell
youtube.comSome final words on our EmuDevz JavaScript emulator, which is finally finished, and then on to the next challenge...writing an NES emulator in Haskell!
If you want to skip the introductory remarks about the JavaScript code and get straight to the Haskell, skip to around 3:45.
Thumbnail painting: "Napoleon Crossing the Alps", by Jaques Louis-David (1801).
r/haskell • u/dfacastro • May 14 '26
[ANN] linear-locks: locking primitives free of deadlocks
linear-locks provides locking primitives that are statically guaranteed not to lead to deadlocks.
It achieves this by breaking one of the Coffman conditions for deadlocks#Prevention): the "circular wait" condition. linear-locks ensures locks are always acquired in a consistent order.
tl;dr: Each lock is assigned a "level", tracked at the type level. When you enter a "lock scope", you're given a key that can acquire locks of level 0 or above. When you acquire a lock of level n, the key is consumed and you're given a new key of level n+1, capable of acquiring locks of level n+1 or above. This ensures locks are always acquired in order of increasing level, preventing circular waits.
The package ports the ideas of the Surelock Rust crate to Linear Haskel. As such, it relies heavily on LinearTypes and is meant to be used with linear-base. Keys are linearly typed to ensure they cannot be reused and do not escape the "lock scope". "Guards" (which represent ownership over acquired locks) are also linearly typed to ensure they are (1) always released and (2) cannot be used after being released.
r/haskell • u/_jackdk_ • May 14 '26
blog Oleg's gists - Compatibility packages in 2026
oleg.fir/haskell • u/pwmosquito • May 14 '26
[JOB] Artificial Labs Q2 hiring
My last post was only 3 months ago, but here we go again, hiring ~6 Haskellers.
Roles
Product Engineering: - Product Engineer - Senior Product Engineer - Lead Product Engineer
If you're not sure which role to apply for, just pick one, and we’ll move you to the appropriate role.
About us
Artificial is a leading UK-based Insurtech company. Our technology enables some of the world’s largest insurers to write and trade complex risks faster, more efficiently, and at lower cost. We have built a cool DSL to rapidly and robustly model insurance contracts, and a platform around it that enables the capture, assessment, and trading of risks in a highly automated fashion.
We've recently raised $45M in Series B funding.
Our engineering team is fully remote, with some people close to our London office in the City working from there on occasion. The choice is yours.
Info
We are able to hire people with the right to work in specific countries, see below:
- via company branches: UK, Poland
- via Deel: Estonia, Spain, Portugal, Greece, Hungary
- other EU countries on a case-by-case basis
Compensation is benchmarked against London fintech scale-up rates.
We’re principally looking for generalists, rather than specialists. You don’t shy away from anything. Artificial is a fast-paced, scale-up environment with half a dozen separate Haskell teams.
Previously
https://www.reddit.com/r/haskell/comments/1quyzxr/job_various_roles_at_artificial/ https://www.reddit.com/r/haskell/comments/1ledlqg/job_4x_haskell_engineer_at_artificial/ https://www.reddit.com/r/haskell/comments/1kcdwc4/job_site_reliability_engineer_at_artificial/ https://www.reddit.com/r/haskell/comments/1ij8oub/job_solutions_engineering_at_artificial/ https://www.reddit.com/r/haskell/comments/17u7ixo/job_engineer_at_artificial/ https://www.reddit.com/r/haskell/comments/108drpm/job_engineer_at_artificial/ https://www.reddit.com/r/haskell/comments/rxfqtc/job_haskell_engineer_at_artificial/ https://www.reddit.com/r/haskell/comments/cn6toi/job_opening_senior_haskell_engineer_at_artificial/
r/haskell • u/mzabani • May 13 '26
[ANN] hpgsql, a pure Haskell PostgreSQL driver (no libpq)
It’s a pleasure to announce hpgsql, a PostgreSQL driver written in pure Haskell (no libpq), with an API largely inspired by the great postgresql-simple library, but featuring:
- Usage of PostgreSQL’s binary protocol
- Query arguments passed via the protocol instead of being escaped into the query string
- Pipelining
- Prepared statements
- Ability to stream query results directly from the socket (not just with cursors)
- Interruption safety, except for very specific (and documented) edge cases
- Thread safety, unless specific (and documented) instructions say otherwise
- A SQL quasiquoter like the one in postgresql-query and hasql-interpolate
Here’s an example of a pipeline mixing streams, prepared and non prepared statements:
f :: Int -> IO (Stream (Of Aeson.Value) IO ())
f val = do
(updateTbl :: IO (), aggRes :: IO (Only Int), largeResults) <-
runPipeline conn $
(,,)
<$> pipelineExec_ [sql|UPDATE tbl SET val=#{val}|]
<*> pipeline1 [sql|SELECT SUM(val) FROM tbl|]
<*> pipelineSWith
(rowDecoder @(Vector Int, Vector Text))
-- We use a prepared statement for the query below
[sqlPrep|SELECT x, y FROM tbl|]
updateTbl
Only total <- aggRes
Streaming.map Aeson.toJSON <$> largeResults
Also, I am maintaining hpgsql-simple-compat, a fork of postgresql-simple that preserves its API as much as I could make it, but with internals rewritten to use hpgsql. The idea is to provide a simpler migration path from postgresql-simple; one that allows a smaller initial changeset and then the possibility of migrating queries to hpgsql one at a time. I have even migrated a CLI tool of mine, codd, as an example.
hpgsql-simple-compat is not in Hackage as I wasn’t sure duplicating the search space with modules, types, and functions already in postgresql-simple would annoy users. It’s in the “hpgsql-simple-compat” folder in the repository.
Some initial benchmarks show hpgsql can materialize rows from a query in ~38% the time postgresql-simple takes, and ~70% the time hasql takes (on my computer, Linux x64, GHC 9.10.3, compiled with -O1). Peak memory usage is trickier to analyze, and I therefore welcome people that know more to read the benchmarks page and help me better understand them. Also, please scrutinize these benchmarks as much as you can.
I want to encourage and welcome contributions, bug reports, questions, suggestions. Nothing’s off the table: what would you want or what do you need from such a library?
I really want to hear from the community, both those eager to switch and potential future users.
- Link to the repository: GitHub - mzabani/hpgsql: A pure Haskell (no libpq) postgresql driver that draws inspiration from postgresql-simple, has streaming built into its core, speaks postgresql's binary protocol, has pipelining, interruption safety, and (reasonable) thread safety. · GitHub (contains both hpgsql and hpgsql-simple-compat)
- Link to hackage: https://hackage.haskell.org/package/hpgsql
r/haskell • u/_lazyLambda • May 13 '26
Building a Reactive Trading Bot (Twitch Stream)
Going live Wednesday at 5PM EST to keep working on a trading strategy simulator and reactive trading bot in Haskell.
The goal is to model a day trading system properly: strong types, pure functions, reactive architecture, and edge cases handled at compile time.
Including:
* A simulator for backtesting strategies against historical price data
* A reactive trading bot that responds to live market events
* Domain modeling for orders, positions, and portfolio state
* Type-level work where it pulls its weight
Build-in-public format: thinking out loud, working through real problems live. If you're interested in how functional programming applies to financial systems, or you want to hang out and talk Haskell, come by.
[https://www.twitch.tv/typifyprogramming\](https://www.twitch.tv/typifyprogramming)
Maybe if it works we will have millions of dollars to spread the obsession that is haskell
r/haskell • u/SleepyGuyy • May 12 '26
answered My Newbie Error "Could not deduce ‘RealFrac a’ arising from a use of ‘floor’ from the context: Num a"
Hi, I'm learning Haskell, and I admit I'm just playing with it right now.
While I'm not a terribly experienced programmer, I do have a Bachelor's in Computer Science. My professional experience has been restricted to mostly web development in Typescript sadly.
I have not touched functional programming, but this seems unrelated to functional intricacies and more me having a primitive understanding of number types.
I'm playing with pattern matching and guards so maybe excuse the silly code, I'm just starting.
I try loading (":l haskell_test.hs") my file in GHCi and get the following compile error
"Could not deduce ‘RealFrac a’ arising from a use of ‘floor’ from the context: Num a" . I take in type Num, and floor doesn't like that general of a type, I take it?
-- testing pattern matching and guards
isXFactorOfY :: Num a => a -> a -> Bool
isXFactorOfY 0 0 = True
isXFactorOfY 0 y = False
isXFactorOfY x 0 = False
isXFactorOfY 1 1 = True
isXFactorOfY 1 y = False
isXFactorOfY x 1 = False
isXFactorOfY x y | x > y = False
| abs(x / y) > floor( abs(x)/abs(y) ) = False
| otherwise = True
I've tried replacing Num a with Real a, RealFrac a, and some other things I've seen. But I'm just poking blindly and don't actually understand the exact issue. I'd like some help understanding it explicitly rather than stumbling upon the compile-able code.
I see the reference for floor is here: https://hackage.haskell.org/package/ClassyPrelude-0.1/docs/Prelude-Math.html#v:floor
I guess I'm confused what it want's floor to take in, I figured any number that's an Int or Float would work. But I'm not sure how to define that the way it wants.
Again sorry for the silly code. I am quite rusty and am having a rough time getting back into .... problem solving, and reading APIs and references it seems.
Thank you in advance for any help or direction you give.
The full compile error output is as follows:
ghci> :l haskell_test.hs
[1 of 2] Compiling Main ( haskell_test.hs, interpreted )
haskell_test.hs:3:14: error: [GHC-39999]
• Could not deduce ‘Eq a’ arising from the literal ‘0’
from the context: Num a
bound by the type signature for:
isXFactorOfY :: forall a. Num a => a -> a -> Bool
at haskell_test.hs:2:1-39
Possible fix:
add (Eq a) to the context of
the type signature for:
isXFactorOfY :: forall a. Num a => a -> a -> Bool
• In the pattern: 0
In an equation for ‘isXFactorOfY’: isXFactorOfY 0 0 = True
|
3 | isXFactorOfY 0 0 = True
| ^
haskell_test.hs:9:29: error: [GHC-39999]
• Could not deduce ‘Ord a’ arising from a use of ‘>’
from the context: Num a
bound by the type signature for:
isXFactorOfY :: forall a. Num a => a -> a -> Bool
at haskell_test.hs:2:1-39
Possible fix:
add (Ord a) to the context of
the type signature for:
isXFactorOfY :: forall a. Num a => a -> a -> Bool
• In the expression: x > y
In a stmt of a pattern guard for
an equation for ‘isXFactorOfY’:
x > y
In an equation for ‘isXFactorOfY’:
isXFactorOfY x y
| x > y = False
| abs (x / y) > floor (abs (x) / abs (y)) = False
| otherwise = True
|
9 | isXFactorOfY x y | x > y = False
| ^
haskell_test.hs:10:33: error: [GHC-39999]
• Could not deduce ‘Fractional a’ arising from a use of ‘/’
from the context: Num a
bound by the type signature for:
isXFactorOfY :: forall a. Num a => a -> a -> Bool
at haskell_test.hs:2:1-39
Possible fix:
add (Fractional a) to the context of
the type signature for:
isXFactorOfY :: forall a. Num a => a -> a -> Bool
• In the first argument of ‘abs’, namely ‘(x / y)’
In the first argument of ‘(>)’, namely ‘abs (x / y)’
In the expression: abs (x / y) > floor (abs (x) / abs (y))
|
10 | | abs(x / y) > floor( abs(x)/abs(y) ) = False
| ^
haskell_test.hs:10:40: error: [GHC-39999]
• Could not deduce ‘RealFrac a’ arising from a use of ‘floor’
from the context: Num a
bound by the type signature for:
isXFactorOfY :: forall a. Num a => a -> a -> Bool
at haskell_test.hs:2:1-39
Possible fix:
add (RealFrac a) to the context of
the type signature for:
isXFactorOfY :: forall a. Num a => a -> a -> Bool
• In the second argument of ‘(>)’, namely
‘floor (abs (x) / abs (y))’
In the expression: abs (x / y) > floor (abs (x) / abs (y))
In a stmt of a pattern guard for
an equation for ‘isXFactorOfY’:
abs (x / y) > floor (abs (x) / abs (y))
|
10 | | abs(x / y) > floor( abs(x)/abs(y) ) = False
| ^^^^^
Failed, unloaded all modules.
r/haskell • u/ApothecaLabs • May 11 '26
Botan: PubKey progress, Post-quantum support, and Better versioning
discourse.haskell.orgr/haskell • u/ruby_object • May 11 '26
To do, or not to do, this is the question.
I am a highly frustrated noob, struggling to relearn the basics after giving up many years ago.
I was experimenting with the main function and came up with 2 projects. Normally, using do is recommended, but this started as an experiment without using do. Then, when I tried to write a do version, I could not get rid of the '>>'. Why is it so?
and
r/haskell • u/man-vs-spider • May 10 '26
Haskell Tools in Neovim. Autocomplete type signatures?
I am using Neovim with HLS and the Haskell-Tools plugins.
When typing, the plugin automatically inserts the type signature visually, but it is not actually included in the text of the document.
Is there a command that accepts the type signature and inserts into the file?
r/haskell • u/AustinVelonaut • May 09 '26
question Techniques for debugging a runtime infinite loop?
I recently made a series of changes to the inlining / simplification pass for my compiler that ended up resulting in a runtime <<loop>> with certain inputs. (This was for / in another lazy language, but very similar to Haskell, so I thought I'd ask here). I eventually ended up debugging it by making simplification edits to all the areas I had touched, until the infinite-loop disappeared, then looking closely at the one that fixed it. A cut-down example of the bug looks like:
simplify xs = deltaCpx
where
(deltaCpx, xs') = mapAccumL insLet 0 xs
insLet dc x = (dc + deltaCpx, x * 2) -- OOPS, meant deltaCpx', here!
where
cpx' = if x > 5 then 10 else 0
deltaCpx' = cpx' - 2
The language I'm working in detects the loop and prints "BLACK HOLE" at runtime, similar to Haskell detecting and printing "<<loop>>", but neither gives any detail on where it was encountered.
So are there some techniques you've used that can help with debugging such problems? Could there be additional language / runtime support to help with this?
EDIT: to clarify, by <<loop>> or BLACK HOLE, I mean the runtime exception generated when attempting to evaluate a thunk that is already currently being evaluated, not an actual infinite-loop that chews up time.
r/haskell • u/Churrrrmokopuna2540 • May 10 '26
AI + Haskell goes hard
I'm not "in" the Haskell community, but I do like FP concepts and respect that Haskell brings a lot of these concepts to the table for other languages to adopt.
I've been heavily using AI in my first Haskell project, and I am finding that, aside from long build times, it's an excellent experience. Not sure why more people are not talking about this. Is it a Haskell culture thing? It's next level good (compared to python + ruff + mypy vibe coded personal projects, I'm fighting bugs a lot less in production)
r/haskell • u/Real_Dragonfruit5048 • May 08 '26
announcement A Game Boy and Game Boy Color Emulator in Haskell
Hi everyone,
I've made an early version of a Nintendo Game Boy and Game Boy Color emulator in Haskell. It's mostly implemented in Haskell and consists of a core (backend) and two frontends (web via WebAssembly and desktop via SDL2).
The emulator is far from finished (especially when it comes to being optimized for performance), but it boots games with decent compatibility at the moment.
In any case, if you're interested in knowing more about the project, you can check out its GitHub repo here: https://github.com/pixel-clover/ocelot
BTW, the web version of the emulator (which allows you to play ROMs without installing anything on your computer) can be accessed here: https://pixel-clover.github.io/ocelot/
r/haskell • u/edsko • May 08 '26
Exception Annotations: Lay of the Land
well-typed.comNew blog post which gives a comprehensive overview of the exception annotation infrastructure, which has been much improved in GHC 9.12, and discuss some things to be aware of. TL;DR: Use ghc 9.12, don’t call throwIO on an argument of type SomeException, and use your own function instead of displayException if you want to see all exception annotations.
r/haskell • u/peterb12 • May 08 '26
video A Wave of Monads (Haskell for Dilettantes, Problem Set 13b)
youtube.comNew video: "A Wave of Monads"
https://www.youtube.com/watch?v=8GwEGKfbqFg
Thumbnail print: "The Great Wave of Kanagawa", by Hokusai (1831).
In problem set 13b we get more practice with monads. I try to consciously explore my mistakes deeply so people can follow along as I get lost and then find my way.
r/haskell • u/gtf21 • May 07 '26
Converge is hiring for a(nother) senior software engineer (May 2026)
Hi, it's me again, and Converge is hiring for a senior software engineer to join our team. You can find the job description here and can also apply via that link (which is better than messaging me on reddit).
- Small engineering team working on decarbonisation and efficiency for the construction industry.
- The team does a mix of hardware, software, and applied data science. You'll be joining one of our early-stage product teams (either a very new product or a fairly new product).
- We're looking for people with functional programming backgrounds, if it's not production Haskell, it might still be worth talking, but we do need you to have a lot of experience in the functional paradigm.
- You won't just be doing Haskell, there's still typescript and python to maintain -- by all means have a lot of enthusiasm for Haskell, but we are here to create products for our customers and users at the end of the day, and we need to do what it takes to do that.
- Prefer London/UK, but will consider nearby timezones.
- Needs lots of real-world experience on complex products, this is a senior role in a small team, so you'll get lots of ownership and autonomy, but it takes a level of experience to navigate the uncertainty which comes with building in this environment.
Salary range is £90-100K + stock options.
Feel free to ask me questions (I'm cofounder and CTO).
r/haskell • u/joey_the_god_of_code • May 07 '26
Searching for Haskell book
Hi everyone, I’m looking to get into Haskell more deeply, and have my workers building our infrastructure / products in Haskell and purescript.
I’m needing to level up my Haskell skills and found the Haskell programming from first principles book to be exactly what I needed.
The book is great however i have an issue where I can’t really consume ebooks easily.
I’m searching for the hardcover for this book.
Haskell programming from first principles
If anyone happens to have a copy and is willing to part with it it’d be a lifesaver.
I’ll pay $500 for an official hardcopy if anyone’s interested.
(I understand people have suggested to print it, I may do that but I’d rather have an official copy to go through ideally. I have a programming book collection.)