r/haskell • • 27d ago

Monthly Hask Anything (October 2026)

9 Upvotes

This is your opportunity to ask any questions you feel don't deserve their own threads, no matter how small or simple they might be!


r/haskell • • 3h ago

How are you meant to use DuplicateRecordFields with record update?

10 Upvotes

So, DuplicateRecordFields allows us to define multiple records with the same fields:

data X = X { id :: Int, ...}

data Y = Y { id :: Int, ...} 

But now, it's not actually possible to use these in a record update without tripping a deprecation warning:

-- Ambiguous record update with parent type constructor 'X'
setXId :: Int -> X -> X
setXId i x = x { id = i }

Best I can tell, there's no real way to avoid this... in this contrived example, I could of course just write something like

setXId :: Int -> X -> X
setXId i X{..} = X{id = i, ..}

But that's just... not using the record update syntax, and gets very unwieldy in places the record update syntax is actually very convenient. The only other option I'm aware is to use module-qualified field names, which then means I have to create a new file for every little datatype I want to introduce? Especially for things like database models, API specs or forms, this is kind of unwieldy.

Otherwise I could of course also just... assign different names to these fields, but that kind of defeats the point of having DuplicateRecordFields.

There's OverloadedRecordUpdate, which I guess "fixes" this, but requires RebindableSyntax (a whole other can of worms) and is still marked as experimental last I checked.

So, am I missing something here? I guess I could use optics/lens, but I extremely rarely have any need for any of the actually "interesting" use cases for these, and they're pretty heavy dependencies just for some basic mucking around with records. So far I've just resorted to `-Wno-ambiguous-fields` because it still works for now, but clearly that's not not the intended long-term strategy.

Full examples

Normal:

{-# LANGUAGE GHC2024, DuplicateRecordFields #-}

newtype X = X { id :: Int }
newtype Y = Y { id :: Int }

-- test.hs:7:18: warning: [GHC-02256] [-Wambiguous-fields]
--    Ambiguous record update with parent type constructor ‘X’.
--    This type-directed disambiguation mechanism will not be supported
--      by -XDuplicateRecordFields in future releases of GHC.
--    Consider disambiguating using module qualification instead.

setXId :: Int -> X -> X
setXId i x = x { id = i }

The version with OverloadedRecordDot (works I guess but I don't really want to turn on RebindableSyntax everywhere)

{-# LANGUAGE
  GHC2024
  , DuplicateRecordFields
  , OverloadedRecordUpdate
  , RebindableSyntax
  , AllowAmbiguousTypes
#-}

import GHC.TypeLits(KnownSymbol)
import Prelude(Int)

newtype X = X { id :: Int }
newtype Y = Y { id :: Int }

setXId :: Int -> X -> X
setXId i x = x { id = i }

getField :: forall f. KnownSymbol f => X -> Int
getField (X i) = i

setField :: forall f. KnownSymbol f => X -> Int -> X
setField _ = X

r/haskell • • 17h ago

[ANN] nonempty-vector-1.0

Thumbnail hackage.haskell.org
39 Upvotes

Hey all,

I'm happy to announce `nonempty-vector-1.0`, coauthored with u/CatboyKoz who contributed a huge amount of code for the unboxed API. I think that generally rounds out the set of features we wanted to get out of `nonempty-vector` and we've closed out every outstanding issue.

Thanks everyone who contributed!


r/haskell • • 6h ago

Mutants at the MCG - 6:00 PM Thurs 12th of November

4 Upvotes

​Tristan Mc Leay - Mutation Testing With Sydtest

The Group

Melbourne Compose Group is the monthly in-person meetup for functional programmers in Melbourne, which this month, is on the second Thursday of the month.

​Our November meeting will be 6:00-8:00 pm Thurs 12th of November at our regular venue, Activity Room 2 at Kathleen Syme Center in Carlton. Arrive from 5:30 for chat and socialising, talks start at 6:30pm. Please RSVP via Luma.

The Talk: ​Tristan Mc Leay - Mutation Testing With Sydtest

​Now that use of AI code generation tools has become prevalent, we need a way
to keep our agents honest. Is our code well tested? Have we skipped tests?
Are the tests sensible or meaningless? All of these could have been problems
before AI, but they take on an increased significance when we can produce
bigger changes than we might be able to genuinely concentrate on.

Mutation testing is a way of checking our test quality as well as our test
coverage: instead of just asking whether a line ran during testing, it asks
whether changes to that line would have caused the tests to fail. In the case
of a typed functional language, that might be swapping an operator, dropping a
case, hard-coding a boolean instead of an if or a guard. If the tests continue
to pass with a change in place, then the test suite is usually insufficiently
sensitive to changes.

Sydtest includes a mutation testing framework for GHC, implemented as a GHC
plugin alongside driver code. It was designed precisely for this problem - as
our coding switches to AI, we need AI to look at our mutation test results to
know what to do next.

In this presentation, I will take a tour of Sydtest’s mutation testing and
apply it to a code base. This code base has poor test coverage and was originally hand written but nowadays is essentially agent-coded.

​As always, newcomers welcome.

​Hope to see you there
-Ben Hutchison & John Walker


r/haskell • • 1d ago

Distributed Haskell - A Small Survey

36 Upvotes

https://www.krook.dev/posts/distributed-haskell/post.html

Hi!

I recently finished my PhD thesis, which contains a couple of pages about distributed Haskell-work. It is by no means an exhaustive survey, as the covered systems (and to what extent they are covered) are chosen by their relevance to my thesis.

I turned the chapter into a blog post, which some of you may enjoy reading.


r/haskell • • 1d ago

We built a community-maintained job board for Formal Verification (FVjobs)

Thumbnail
14 Upvotes

r/haskell • • 2d ago

Planned maintenance for gitlab.haskell.org, downloads.haskell.org, mail, and more: 2026-10-27

Thumbnail discourse.haskell.org
16 Upvotes

r/haskell • • 2d ago

Save the date for AmeriHac 2027

16 Upvotes

Location: New York, New York Dates: February 6-7, 2027

You can now register for the event via Eventbright!

More details on the event page!


r/haskell • • 2d ago

A New Feature in Waterfall-CAD

Thumbnail youtube.com
58 Upvotes

r/haskell • • 2d ago

announcement Idempotency tokens in Amazonka are ready for testing

Thumbnail discourse.haskell.org
20 Upvotes

r/haskell • • 4d ago

Great read for performant FP code

36 Upvotes

https://rtfeldman.com/fp-vs-c

Great article by the creator of Roc lang! I don't really know how it comes to Haskell though, so open to discussion


r/haskell • • 5d ago

`hs-bindgen` playground

30 Upvotes

I am happy to announce that the hs-bindgen playground is now live:

https://bindgen.well-typed.com/

hs-bindgen creates Haskell bindings from C header files. For more information, have a look at the recent blog post about the first official release. Most features are directly available in the playground.

Feedback much appreciated!


r/haskell • • 7d ago

Don't use scientific for calculations, it can segfault and run out of memory.

Thumbnail github.com
30 Upvotes

r/haskell • • 6d ago

question Can AI reliably reverse engineer Haskell?

0 Upvotes

15 years ago, someone posted this question about reverse engineering Haskell. The conclusion was

GHC's output, stripped, is more difficult to reverse engineer than that of a similar program written in C or C++. That is due to the increased indirection, different idioms, and lack of interest and tools.

With all the recent news about people using AI to reverse engineer video games, Photoshop and other software, I'm wondering if that conclusion is still true. Have any of you tried using AI agents to reverse engineer a Haskell binary that's been stripped of its symbols? If so, what was the program and how well did it work?

I'm interested because I'm developing a video game in Haskell on my own. I'm not using generative AI, and I was planning to release a free prototype, to solicit feedback and kick-start my marketing campaign. But now I have to consider the likelihood of someone using the prototype to vibe-code a cheap knock-off and beat me to market.

EDIT: I'm aware that people can vibe-code a knock-off by describing it and giving screenshots/videos to an AI agent. I'm just wondering if decompiling the prototype would be an easy way for someone to greatly improve the result. I.e. I'm looking for information on what's achievable at a given cost, so that I can do a risk assessment.


r/haskell • • 9d ago

question What do you use Haskell for?

68 Upvotes

Not in a general "what is Haskell typically used for" way but I mean, what do you personally use it for? I've been learning Haskell off and on for the last year or so mostly as a curiosity, and I've come to like it and many of its concepts a lot, but I've yet to really have a reason to use it to write some program over what I already know (which is Python, primarily - I mostly write automation scripts and projects wrapping web APIs to use for various purposes). All of the Haskell I've written so far has basically just been exercises and coding puzzles. So for those who either use it frequently or are also learning it, what sort of things are you practically using it for?


r/haskell • • 9d ago

Here is a minimal implementation of subset of Haskell for learning

1 Upvotes

EDIT: Vibe coded, not bragging about the code, just sharing the tool.

husk - A lightweight interpreted Haskell implementation compiled to Chez Scheme

The size of software packages I needed to install in order to use Haskell for daily scripts bothered me many times, especially when all I wanted was to solve a problem without the need for advanced features, or when learning the language.
At the time the only practical option was GHC because the others were obsolete or incompatible with the learning materials.

Now that AI is here I tried to make my wish come true, and I think I succeeded in making (vibe coding) something that is useful for me, and maybe for others.
Introducing husk, a new implementation that tries to be small and compatible with learning materials, and doesn't try to implement all Haskell features or be compatible with existing popular libraries.

If you have serious work use GHC.

The point of husk is to be small enough to run everywhere Chez Scheme runs and be there for you to study with, or write daily scripts.

Now I'm not advocating for vibe coding, nor am I sure that it's very good (I'm not a Haskell expert so it's hard for me to judge though I ran many automated tests). All I'm saying is that it's small (1.3MB) and runs all LYAH and a few other popular learning materials exercises.

Easy to install on Arch Linux: AUR


r/haskell • • 10d ago

question Typeclass Show is not defined in the class but required in the implementation. How do I “backfill” this constraint?

7 Upvotes

How do I make a string from ‘a’ in #1 without Show defined in `num`. I cannot change class BaseOps to add Show. Thanks

class BaseOps f where
  num :: Num a => a -> f a
  plus :: Num a => f a -> f a -> f a
 
newtype Pretty a = Pretty String

instance (Show a) => Show (Pretty a) where
  show (Pretty a) = show a — #1

instance BaseOps Pretty where
  num a = Pretty $ show a
  plus (Pretty a) (Pretty b) = Pretty $ a <> " + " <> b
 
main :: IO ()
main = do
  let x :: Pretty Int = plus (num 1) (num 2)
  putStr $ show x


r/haskell • • 11d ago

Haddock build fails because of GHC2024

3 Upvotes

I uploaded a package on Hackage which has the GHC2024 extension enabled, but the build fails since Hackage compiles using ghc-9.8.4 (according to build log). Hence, no documentation is generated neither.

How can this be fixed?


r/haskell • • 12d ago

announcement 3D Graphics Engine in Haskell

Thumbnail gallery
97 Upvotes

Github

Hackage

I wrote a 3d graphics rasterizer in Haskell that runs inside a command prompt. It can handle affine or projective projection.The Github link above also has pipelines that auto build compiled demos under releases for Linux and Windows if you want to explore the demo worlds.


r/haskell • • 12d ago

Cabal can't find the main function on a loaded source file

2 Upvotes

Hello everyone,

I'm having a very weird problem with cabal on an Orange Pi Zero 2. Convenient little thing, on 24/7 for pennies and I can ssh to it from anywhere. I thought I should use it for learning Haskell recently (been on Pis previously) but I'm facing some weird issues with it, specifically cabal.

It's running Armbian 26.8.3 Bookworm, aarch64 distro, Debian based of cource, installed GHC is v9.0.2 ans Cabal is v3.4.1.0 (install via apt as cabal-install package).

At first cabal would not even start due to a missing root.json file which I had to download from hackage.haskell.org and place it in the "~/.cabal/packages/hackage.haskell.org/" directory.

Then I run "cabal repl" and manually load my source file with ":l", without any errors, but when I invoke the main function it acts as if it's not in the source file. Even sth as simple as

'''

main :: IO ()

main = do

putStrLn "Hello world!"

'''

loads fine (Ok, one module loaded) but I get the error of "Variable not in scope: main". And it turns out this is for every function in the source file.

This is clearly a buggy installation. Any idea how I can troubleshoot it?

Note: I find it puzzling that cabal just works on the Pis, also debian based, but not on this particular distro.


r/haskell • • 13d ago

puzzle Andrea Bedini (+Claude) has bootstrapped GHC 9.14 from Hugs, via MicroHS and a lot of intermediate GHCs

Thumbnail discourse.haskell.org
66 Upvotes

r/haskell • • 12d ago

ghcitty 0.5.0: a Fast, Friendly GHCi 🐈⚡- Now with easy Core/STG/Cmm inspection for any expression + Typed-Hole completions (+ Syntax Highlighting, Ghost Completions, Easy Multiline, Vi-mode, Hoogle, etc)

36 Upvotes

Hello all! ghcitty now has easy Core/STG/Cmm inspection + typed hole completions + various nitfixes.

Thank you for the great feedback last time ... let me know if you find any more rough edges!

Still tinkering with extending (the excellent) haskeline to have some of these fish/nushell features ...

but... having a Rust binary not be tied to a specific GHC version has been making things more flexible in a somewhat odd way (happy to bounce on this)


r/haskell • • 14d ago

Shouldn't "No bots or computer-generated content?" apply to vibe-coded projects?

44 Upvotes

Or at least have a rule similar to "Blockchain posts must be tagged", i.e. "AI assisted posts must be tagged".


r/haskell • • 14d ago

[ANN] base64-2.0 is finally here

34 Upvotes

Hey all, feeling productive, might delete later.

I added the long-awaited SIMD support for the base64 library, supporting SSE3, AVX2, and NEON along with whatever else I could effectively test. It's behind a flag that's off by default so no real change there, however, it comes very close to `simdutf8` and beats `fastbase64` by a good margin on encode and decode.

Hope you all enjoy - there are some API changes that make more sense, so please check out the `MIGRATION-2.0.md` and migrate accordingly if you need to. After doing some due diligence on downstream dependencies available on Hackage, nothing should break, but you never know. Easy fixes in any case.

Cheers!

~E


r/haskell • • 14d ago

blog Types of types: Haskell's Kind system

24 Upvotes

Wrote about Haskell's Kind system. Let me know what you think!

https://thunk.blog/posts/types-of-types-haskell-kind-system/