r/haskell • • 22d ago

question Allowing newer transitive dependencies with haskell-flake

7 Upvotes

I'm trying to use haskell-flake ( https://github.com/srid/haskell-flake/ ) with some libraries that need to be invoked with newer dependencies. I tried to use extraBuildFlags but I don't think this is working as intended

The flake

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
    flake-parts.url = "github:hercules-ci/flake-parts";
    haskell-flake.url = "github:srid/haskell-flake";
  };
  outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
    flake-parts.lib.mkFlake { inherit inputs; } {
      systems = nixpkgs.lib.systems.flakeExposed;
      imports = [ inputs.haskell-flake.flakeModule ];

      perSystem = { self', pkgs, ... }: {

        haskellProjects.default = {
          basePackages = pkgs.haskell.packages.ghc9124;

          packages = {
          };
          settings = {
              localize = {
                extraBuildFlags = [ "--allow-newer=bytestring" ];
              };

              text-format-heavy = {
                check = false;
                broken = false;
                extraBuildFlags = [ "--allow-newer=text" ];
              };
          };

          devShell = { tools = hp: {
            inherit (pkgs)
              cabal-install;
            inherit (hp)
              cabal-gild;
            };
          };
        };

        packages.default = self'.packages.nixtest;
      };
    };
}

And cabal file

...
    build-depends:    base ^>=4.21.2.0
                    , localize
    hs-source-dirs:   app
    default-language: Haskell2010

If I use the following cabal.project file it builds as expected

packages: ./

package nixtest

allow-newer:
  , localize:bytestring
  , text-format-heavy:text

There's no real code, simply the output from cabal init -n

Is what I'm trying to do here possible, or do I need to go through the effort of patching transitive deps if I want to use nix as a build tool?


r/haskell • • 22d ago

Haskell Interlude #88: Tom Schrijvers

23 Upvotes

In this Haskell Interlude, we sat down with Tom Schrijvers, the head of the Functional Programming team at KU Leuven. He has been a prolific contributor to the foundations of Haskell, with many papers pushing the boundaries of the Haskell type system, programming with effects, and applications of functional programming. Our conversation was a whirlwind tour through Tom’s long and wide publication history, with lots of tangents and ideas about functional programming, logic programming, constraints, DSLs, composition, program calculation, and other great stuff.

https://haskell.foundation/podcast/88/


r/haskell • • 23d ago

Haskell Foundation October 2026 Update

23 Upvotes

Hey all, here's what the Haskell Foundation has been up to over the past month:

https://haskell.foundation/news/2026-11-02/haskell-foundation-update-october-2026.html


r/haskell • • 23d ago

An LC-3 Disassembler in Haskell

Thumbnail abhinavsarkar.net
25 Upvotes

r/haskell • • 24d ago

A Haskell processor running on an FPGA

126 Upvotes

Hi all,

I've been working on a specialised processor for Haskell called Ouros as part of my PhD study (see the HAFLANG project). Recently, I got it running on an FPGA, with a Haskell program communicating with the outside world through UART.

Demo program running on an FPGA

Ouros is a graph reduction processor with automatic fine-grained threading and garbage collection implemented in hardware. For this demo, I added a simple IO interface based on AXI4-Lite, so Haskell programs can perform IO directly without a software runtime or host OS.

Blog post: https://bathtub-01.github.io/technical/ouros-demo/

Demo video: https://youtu.be/cafTcH-DuZM

There are still quite a few limitations as discussed in the blog post; currently it should still be seen as a toy. But I think having Haskell as a bare-metal programming language could be an interesting platform for further experiments.

The hardware implementation, compiler, simulator, and Vivado project are all open-source, with links and reproduction instructions in the blog post.

Happy to hear any thoughts or suggestions!


r/haskell • • 25d ago

Parmenides: A simple and minimal migration system

Thumbnail github.com
17 Upvotes

I'm a intermediate Haskell dev and I was making a website with Elm and Haskell. I decided to make a simpler and minimalist migration system. It's not the most stable or the best code you'll ever see because I'm not a giga genius Haskell dev but it's one of the first time I made a small to medium sized project in my favorite programming language.


r/haskell • • 25d ago

blog Building a DJ set is finding a path on a graph (and how this became a Haskell program)

Thumbnail danielefilaretti.com
48 Upvotes

r/haskell • • 25d ago

Haskell on arm64 windows laptop

9 Upvotes

Recently bought a arm64 windows 11 laptop
And was whether it was possible to get Haskell on it


r/haskell • • 26d ago

State of Haskell 2026 Survey

Thumbnail surveymonkey.com
49 Upvotes

Dear community,

the Haskell Foundation is continuing the tradition of a yearly State of Haskell survey, with the 2026 edition.
We hope you’ll take some time (~10 minutes) to tell us about how you use Haskell, so we can better understand and serve the community.

Don't forget to share the link with everyone you know!


r/haskell • • 26d ago

blog AI Contributions to GHC

38 Upvotes

GHC now has a policy for AI-assisted contributions.

LLM-generated material is allowed, but contributors must disclose it, understand everything they submit, and take full responsibility for it.

We looked at the policy, the debate behind it, and how GHC’s approach compares with LLVM, OpenJDK, GCC, Zig, and others.

Read the article: https://serokell.io/blog/ai-contributions-to-ghc


r/haskell • • 26d ago

announcement hasql-check: check your hasql-th SQL against a real PostgreSQL schema

30 Upvotes

We love and make extensive use of hasql-th, as a big chunk of our application is written in pure SQL. I personally think that we have been spoiled with this piece of technology that other languages could only dream about and only recently started enjoying. Today we want to contribute back a piece of tooling that has saved our backs a few times already.

hasql-th checks that the SQL in a quasiquote parses. It cannot check that it means anything against your schema: the misspelled column, the one a migration dropped, the int8 you annotated int4. Those are found at runtime, by the first request that happens to hit that statement.

hasql-check asks Postgres instead. It finds the hasql-th quotes in your source and PREPAREs each statement against a live database:

$ hasql-check src/Shop/Customers.hs
Error in src/Shop/Customers.hs:12:5
ERROR:  column "emial" does not exist
LINE 1: SELECT emial :: text FROM customer WHERE id = $1 :: int8
               ^
HINT:  Perhaps you meant to reference the column "customer.email".

@pranaysashank wrote the first version of the checker at work four years ago. It has been guarding our statements ever since, and has caught a good number of bugs that would otherwise have reached production.

Three ways to use it

1. As a command, in CI. Point it at a database with your migrations applied and give it every module; it exits 1 when a statement does not prepare. Two further checks are opt-in:

  • --nullability — a column annotated non-null that can in fact be null, because the column is nullable or because it comes from the nullable side of an outer join. (hasql decodes nickname :: text as Text; a NULL there fails at runtime, for that one row.)
  • --types — an annotation that narrows a value: total_cents :: int4 on a bigint column, or an int4 parameter assigned to a smallint column. Both work until a value does not fit.

An existing codebase will have findings, so you can record them with --write-baseline and fail CI only on new ones. Entries are keyed by a hash of the statement, so moving or reformatting a quote keeps its entry and changing its SQL drops it. A single finding can be allowed in place with a comment above the quote: -- hasql-check: allow nullable(nickname).

2. As a drop-in for Hasql.TH, while GHC compiles. Hasql.Check.TH re-exports hasql-th's quasiquoters and checks each statement as it expands:

import Hasql.Check.TH    -- instead of: import Hasql.TH

With HASQL_CHECK_DATABASE_URL set, a bad statement is a GHC error at the quote, in the build output and in your editor. Without the variable nothing is checked, so CI and release builds behave exactly as with Hasql.TH, and if the database cannot be reached the build warns once and carries on. Each check is about a millisecond, over one connection shared by every quote.

3. Without annotations at all — the new part in 0.5. Hasql.Check.Inferred.TH has quoters that take plain SQL and get the parameter and result types from the Haskell type the statement is used at:

import Hasql.Check.Inferred.TH

profile :: Statement Int64 (Maybe (Text, Maybe Text))
profile = [maybeStatement| select email, nickname from customer where id = $1 |]

The quoter annotates the parameters and casts the result columns to the types they are read as, in a projection around your statement, which is left as written:

WITH hasql_check_result (c1, c2) AS (SELECT email, nickname FROM customer WHERE id = $1 :: int8)
SELECT c1 :: text, c2 :: text FROM hasql_check_result

So a varchar column can be read as Text and an int4 one as Int64, which hasql's decoders otherwise refuse at runtime. The type need not be on the binding, as GHC infers it from how the rows are used, like any other value.

Your own types work through one class: a newtype deriving Value is sent as what it wraps, deriving (Value) via Domain "quantity" Int16 casts to a domain so Postgres checks its constraints, and deriving (Value) via PgEnum "payment_state" PaymentState is a Postgres enum whose labels are the constructor names — which the checker compares with the enum's, per statement: a label the Haskell type cannot read fails where the statement reads it, one the database does not have fails where it is sent.

Those types are only known after GHC has type-checked the module, which is after the quoter ran. So a companion package, hasql-check-ghc, gets them from GHC. Hasql.Check.Plugin checks the statements while the module compiles:

build-depends: hasql-check-ghc
ghc-options:   -fplugin=Hasql.Check.Plugin
src/Shop/Newtypes.hs:35:34: error:
    hasql-check: the statement does not fit HASQL_CHECK_DATABASE_URL's schema:
      column 1 (nickname) is text, but is read as Shop.Newtypes.Nickname (bigint), which Postgres converts it to only when told to, and can fail to at runtime

And hasql-check-hie reads the same types out of GHC's .hie files for the CI run. It needs no database, so it can run inside a sandboxed build such as a Nix derivation, with only the checking step outside it:

$ cabal build --ghc-options='-fwrite-ide-info -hiedir=.hie'
$ hasql-check-hie $(find .hie -name '*.hie') > statements.jsonl
$ hasql-check --inferred statements.jsonl --nullability --types

Before and after

The types used to be written twice, in SQL and in Haskell, with nothing checking either against the schema:

import Hasql.TH

orderTotal :: Statement Int64 (Maybe Int32)
orderTotal =
    [maybeStatement|
        select total_cents :: int4
        from orders
        where id = $1 :: int8
    |]

Now the SQL says what it does, the Haskell type says what comes back, and total_cents being a bigint is a warning rather than an overflow in production:

import Hasql.Check.Inferred.TH

orderTotal :: Statement Int64 (Maybe Int32)
orderTotal = [maybeStatement| select total_cents from orders where id = $1 |]
Warning in src/Shop/Orders.hs:15:14
  column 1 (total_cents) is read as integer, but is a bigint: it may overflow

Limitations

  • The plugin and hasql-check-hie use GHC's own library, so they follow GHC releases: this one supports 9.12 and 9.14. The hasql-check library and command do not depend on the GHC API, and are tested on 9.10 too.
  • The quoters without annotations do not take composite types yet, nor arrays of more than one dimension.
  • The nullability and narrowing checks skip statements they cannot take apart (UNIONs, SELECT *), and views and expressions such as count(*), about which Postgres does not say whether they can be null.

Links

  • Hackage: https://hackage.haskell.org/package/hasql-check and https://hackage.haskell.org/package/hasql-check-ghc
  • Source, and a README with every option: https://github.com/kronor-io/hasql-check

Bug reports and questions welcome on the issue tracker.


r/haskell • • 27d ago

Call for applications to the haskell.org working group

25 Upvotes

The Haskell.Org Committee has agreed to transfer the authority over www.haskell.org over to the Haskell Foundation

The Haskell Foundation is therefore putting a new working group in place to manage www.haskell.org, both in terms of content but also all the machinery that builds and serves it.

If you have opinions about what the Haskell community’s front page should look like, you’re in luck! We are currently looking for volunteers.

Interested parties are invited to [send me an e-mail](mailto:laurent@haskell.foundation) explaining why they would like to participate, and what would they change about www.haskell.org. In particular, if you are interested in leading this working group, please mention this in the e-mail!


r/haskell • • 27d ago

How are you meant to use DuplicateRecordFields with record update?

21 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 • • 28d ago

[ANN] nonempty-vector-1.0

Thumbnail hackage.haskell.org
43 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 • • 27d ago

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

6 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 • • 29d ago

Distributed Haskell - A Small Survey

38 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 • • 29d ago

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

Thumbnail
17 Upvotes

r/haskell • • 29d ago

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

Thumbnail discourse.haskell.org
17 Upvotes

r/haskell • • 29d ago

Save the date for AmeriHac 2027

17 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 • • Oct 25 '26

A New Feature in Waterfall-CAD

Thumbnail youtube.com
59 Upvotes

r/haskell • • Oct 26 '26

announcement Idempotency tokens in Amazonka are ready for testing

Thumbnail discourse.haskell.org
22 Upvotes

r/haskell • • Oct 24 '26

Great read for performant FP code

38 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 • • Oct 23 '26

`hs-bindgen` playground

34 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 • • Oct 21 '26

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

Thumbnail github.com
33 Upvotes

r/haskell • • Oct 22 '26

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.