haskell / haskell/haskell-language-server
With UnicodeSyntax enabled, the case-split plugin should prefer ordinary syntax if all already existing patterns use it
- Dominant language
- Haskell
- Stars
- 3k
- Forks
- 455
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 12
Description
Provided the `UnicodeSyntax` is enabled (not sure it'll ever become enabled by default) and not disabled locally to the source file being edited, the case-split plugin should prefer using `->` if already existing patterns, if any, use that instead of the unicode arrow.
In other words, calling the plugin on both `case`s below
```haskell
{-# OPTIONS_GHC -Wall #-}
{-# OPTIONS_GHC -Wno-typed-holes #-}
{-# LANGUAGE UnicodeSyntax #-}
module Foo where
foo :: a
foo = case _ :: Bool of
False -> _
bar :: a
bar = case _ :: Bool of
```
currently results in this:
```haskell
-- as above
foo :: a
foo = case _ :: Bool of
False -> _
True → _
bar :: a
bar = case _ :: Bool of
False → _
True → _
```
should result in this (notice the `->` instead of `→` in the `True` alternative in `foo`'s definition):
```haskell
-- as above
foo :: a
foo = case _ :: Bool of
False -> _
True -> _
bar :: a
bar = case _ :: Bool of
False → _
True → _
```
Clearly, if there's more 2 or more existing patterns and they don't agree, a choice needs to be made (honor the last, honor the first, honor the most frequent, honor at least one unicode, ...).
Originally considered during [my GSoC 2026 project](https://gist.github.com/Aster89/69a57c364ec2d0cc89f474cc3d194371#future-work--stretch-goals).
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the case-split plugin implementation and its existing tests, then reproduce the two Haskell examples from the issue with UnicodeSyntax enabled. The change is done when a new alternative follows the ordinary or Unicode arrow style already used in the surrounding patterns, with a defined behavior for conflicting existing styles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100