!RbXGJhHMsnQcNIDFWN:nixos.org

Haskell in Nixpkgs/NixOS

681 Members
For discussions and questions about Haskell with Nix, cabal2nix and haskellPackages in nixpkgs | Current Docs: https://nixos.org/manual/nixpkgs/unstable/#haskell | Current PR: https://github.com/nixos/nixpkgs/pulls?q=is%3Apr+is%3Aopen+head%3Ahaskell-updates | Maintainer Docs: https://github.com/NixOS/nixpkgs/blob/haskell-updates/pkgs/development/haskell-modules/HACKING.md | More Nix: #community:nixos.org | More Haskell: #haskell-space:matrix.org | Merger Schedule: https://cloud.maralorn.de/apps/calendar/p/H6migHmKX7xHoTFa/dayGridMonth/now | Join #haskell.nix:libera.chat for question about the alternative haskell.nix infrastructure133 Servers

Load older messages


SenderMessageTime
1 Dec 2025
@acidbong:envs.net@acidbong:envs.net moin
for defining variables that aren't supposed to be exported (like in single-file programs), what's more idiomatic/common in haskell: multiple top-level assignments before the main function or let..in block(s)?
06:08:05
@b:chreekat.netchreekat

Probably not the right room to be asking (sorry), and I'm not sure there is an option that's more idiomatic. But I'll give my own recommendations and heuristics:

  1. Always use explicit export lists so you only export the things you want exported. It's helpful to the compiler as well as your future self
  2. Anything that needs a do block usually goes on the top level
  3. lets and wheres are good for one-line unpacking or manipulating of function arguments, but it gets confusing if you can't see the place where the arguments are declared on the same screen
  4. I usually put top-level helpers after the function they are helping, and I usually use let instead of where.
  5. Nesting lets and wheres is awful
07:46:35
@acidbong:envs.net@acidbong:envs.net
In reply to @b:chreekat.net

Probably not the right room to be asking (sorry), and I'm not sure there is an option that's more idiomatic. But I'll give my own recommendations and heuristics:

  1. Always use explicit export lists so you only export the things you want exported. It's helpful to the compiler as well as your future self
  2. Anything that needs a do block usually goes on the top level
  3. lets and wheres are good for one-line unpacking or manipulating of function arguments, but it gets confusing if you can't see the place where the arguments are declared on the same screen
  4. I usually put top-level helpers after the function they are helping, and I usually use let instead of where.
  5. Nesting lets and wheres is awful
oh damn, i confused the room
09:06:53
@acidbong:envs.net@acidbong:envs.net left the room.09:08:17
2 Dec 2025
@mequbic:matrix.orgiqubic (she/her)

Well... the Haskell LSP is throwing errors for me on NixOS. I have it installed via my nix-shell:

{ pkgs ? import <nixpkgs> {} }:
let
  src = pkgs.nix-gitignore.gitignoreSource [] ./.;
  myPkg = pkgs.haskellPackages.callCabal2nix "aoc25" src {};
in
pkgs.stdenv.mkDerivation {
  name = "aoc-shell";

  buildInputs = [
    myPkg.env.nativeBuildInputs

    pkgs.cabal-install
    pkgs.haskell-language-server
    pkgs.hlint
    pkgs.ormolu
  ];
}
06:04:21
@mequbic:matrix.orgiqubic (she/her)That's pulling in GHC 9.10.306:04:51
@mequbic:matrix.orgiqubic (she/her) After doing some work on a Haskell program of mine, I got this message dumped into stderr:
https://dpaste.alwaysdata.org/2T0oxtWG
06:05:52
@mequbic:matrix.orgiqubic (she/her) * That's pulling in GHC 9.10.3 from nixpkg-unstable 06:06:20
@mequbic:matrix.orgiqubic (she/her) At least, that's the what I see in the error log of Emacs's lsp-mode 06:06:31
@mequbic:matrix.orgiqubic (she/her)Seems to be related to HLint, as I was attempting to do an HLint refactor when the LSP crashed.06:07:31
@mequbic:matrix.orgiqubic (she/her)Also, I found this: https://github.com/haskell/haskell-language-server/issues/467406:07:36
@mequbic:matrix.orgiqubic (she/her)What should I do here?06:08:02
@maralorn:maralorn.demaralorn

iqubic (she/her): One of

  1. disable the hlint plugin in your editor config.

  2. disable the hlint plugin by locally overriding the hls package

  3. disable the hlint plugin by adding (and upstreaming) an override in nixpkgs

  4. wait for the hls release which disables the hlint plugin to propagate to you.

  5. or 4. needs to happen and needs to be backported to 25.11 because we shouldn’t have a broken hls there.

08:43:21
@maralorn:maralorn.demaralornArgh, matrix. Why do you do this to me? Why do you destroy my carefull numbering.08:43:58
@maralorn:maralorn.demaralorn iqubic (she/her): Sadly hls is kinda in a bad place because I am in a bad place. :-/. 08:45:28
@maralorn:maralorn.demaralornAs in: My other duties are completely preventing me from fixing stuff in nixpkgs.08:46:35
@mequbic:matrix.orgiqubic (she/her)I see16:50:48
@mequbic:matrix.orgiqubic (she/her) maralorn: Would you be able to tell me how to modify my shell.nix to disable HLS for now? 16:54:57
@maralorn:maralorn.demaralorndisable HLS or disable hlint?17:00:35
@maralorn:maralorn.demaralorn iqubic (she/her): You need to apply haskell.lib.compose.disableCabalFlag "hlint" to hls. 17:03:08
@maralorn:maralorn.demaralorn e.g. packages = p: [(haskell.lib.compose.disableCabalFlag "hlint" p.haskell-language-server)] or something similar. 17:03:51
@maralorn:maralorn.demaralorn * e.g. buildInputs = [(haskell.lib.compose.disableCabalFlag "hlint" pkgs.haskell-language-server)] or something similar. 17:04:11
@maralorn:maralorn.demaralorn * e.g. buildInputs = [(pkgs.haskell.lib.compose.disableCabalFlag "hlint" pkgs.haskell-language-server)] or something similar. 17:04:22
@mequbic:matrix.orgiqubic (she/her)Actually, I can just tell Emacs to disallow HLint code action stuff. Would that be sufficient for now?17:06:59
@mequbic:matrix.orgiqubic (she/her) maralorn: What do you think? 17:07:10
@maralorn:maralorn.demaralornYou can tell emacs to deactivate the hlint plugin.17:07:50
@maralorn:maralorn.demaralornI don’t know if disabling the code actions does suffice. I think the crash already happens on calculation of available code actions so you have to be early enough.17:08:36
@maralorn:maralorn.demaralorn* I don’t know if disabling the code actions does suffice. I think the crash already happens on calculation of available code actions so you have to be "early enough".17:08:45
@mequbic:matrix.orgiqubic (she/her)

This isn't working for me (pkgs.haskell.lib.compose.disableCabalFlag "hlint" pkgs.haskell-language-server)

LATITUDE-NIXOS hs/aoc25 » nix-shell                                                                         127 ↵
fetching path input 'path:/nix/store/3w2nr2aq2gp76nb6lh1alx6h10mwvp5d-source'
building '/nix/store/mlbpkxipyf763cm4hcanls6wp3mm5vb1-cabal2nix-aoc25.drv'...
error:
       … while evaluating an expression to select 'drvPath' on it
         at «internal»:1:552:
       … while evaluating strict
         at «internal»:1:552:
       (stack trace truncated; use '--show-trace' to show the full trace)

       error: function 'anonymous lambda' called with unexpected argument 'mkDerivation'
       at /nix/store/3w2nr2aq2gp76nb6lh1alx6h10mwvp5d-source/pkgs/development/tools/haskell/haskell-language-server/withWrapper.nix:1:1:
            1| {
             | ^
            2|   lib,

       note: trace involved the following derivations:
       derivation 'aoc-shell'
17:14:55
@mequbic:matrix.orgiqubic (she/her) maralorn: What should I do here? 17:17:03

Show newer messages


Back to Room ListRoom Version: 6