Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatter drops unboxed tuples hashes #444

Open
riz0id opened this issue Jan 20, 2023 · 1 comment
Open

Formatter drops unboxed tuples hashes #444

riz0id opened this issue Jan 20, 2023 · 1 comment

Comments

@riz0id
Copy link

riz0id commented Jan 20, 2023

The formatter will reformat unboxed tuples to regular tuples by dropping the # character and removing necessary whitespace between the unboxed tuple and tuples elements. For example, the following type:

import GHC.Exts (State#, RealWorld)

newtype T a = T { unT# :: State# RealWorld -> (# State# RealWorld, a #) }

would be reformatted as:

newtype T a
  = T { unT# :: State# RealWorld -> (State# RealWorld, a) }

I'm not sure if this is specific to certain configuration. The formatter will drop unboxed tuples even if:

  • The .stylish-haskell.yaml option has cabal: false and UnboxedTuples listed under language_extensions:.
  • The UnboxedTuples extension is listed under default-extensions in the package cabal file.
  • A {-# LANGUAGE UnboxedTuples #-} pragma is added to the *.hs file containing the type T.
@riz0id
Copy link
Author

riz0id commented Jan 20, 2023

The only way to prevent the formatter from altering the definition of a type containing unboxed tuples is to rewrite the type as:

newtype T a = T { unT# :: State# RealWorld -> (#,#) (State# RealWorld) a }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant