Skip to content

[Haskell] Haskell highlighting: explicitly importing recursive datatype + constructor #3658

@foxyseta

Description

@foxyseta

What steps will reproduce the bug?

Try to highlight the following Haskell code:

import Data.List.NonEmpty (NonEmpty ((:|)), last)

What happens?

Screenshot of me running 'bar test.hs' on my terminal.

What did you expect to happen instead?

The :| constructor brings the parser to the wrong state, so last is not coloured as an imported identifier, like NonEmpty is. Rather, the keyword as is detected as a substring of it.

How did you install bat?

Alpine package


bat version and environment

Details

Software version

bat 0.26.1

Operating system

  • OS: Linux (Alpine Linux 3.24.0_alpha20260127)
  • Kernel: 6.18.20-0-lts

Command-line

bat --diagnostic test.hs 

Environment variables

BAT_CACHE_PATH=<not set>
BAT_CONFIG_PATH=<not set>
BAT_OPTS=<not set>
BAT_PAGER=<not set>
BAT_PAGING=<not set>
BAT_STYLE=<not set>
BAT_TABS=<not set>
BAT_THEME=<not set>
COLORTERM=truecolor
LANG=<not set>
LC_ALL=<not set>
LESS=<not set>
MANPAGER=<not set>
NO_COLOR=<not set>
PAGER=<not set>
SHELL=/usr/bin/fish
TERM=xterm-256color
XDG_CACHE_HOME=<not set>
XDG_CONFIG_HOME=/home/foxy/.config

System Config file

Could not read contents of '/etc/bat/config': No such file or directory (os error 2).

Config file

Could not read contents of '/home/foxy/.config/bat/config': No such file or directory (os error 2).

Custom assets metadata

Could not read contents of '/home/foxy/.cache/bat/metadata.yaml': No such file or directory (os error 2).

Custom assets

'/home/foxy/.cache/bat' not found

Compile time information

  • Profile: release
  • Target triple: x86_64-alpine-linux-musl
  • Family: unix
  • OS: linux
  • Architecture: x86_64
  • Pointer width: 64
  • Endian: little
  • CPU features: fxsr,sse,sse2
  • Host: x86_64-alpine-linux-musl

Less version

> less --version 
less 692 (POSIX regular expressions)
Copyright (C) 1984-2026  Mark Nudelman

less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Home page: https://greenwoodsoftware.com/less

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions