haskell / stylish-haskell

Haskell code prettifier
Other
986 stars 150 forks source link

Unknown extension: "NoStarIsType" #401

Closed Mikolaj closed 2 years ago

Mikolaj commented 2 years ago
stylish-haskell --version
stylish-haskell 0.14.1.0

It accepts StarIsType fine, but doesn't accept NoStarIsType either in config file nor in file header, saying

Warning (stylish-haskell): stylish-haskell failed: Unknown extension:
    "NoStarIsType"

and due to that, not accepting

import           GHC.TypeLits (type (*))
chshersh commented 2 years ago

I have the same problem with NoImplicitPrelude. Here is my .stylish-haskell.yaml:

steps:
  - simple_align:
      cases: true
      top_level_patterns: true
      records: true

  # Import cleanup
  - imports:
      align: none
      list_align: after_alias
      pad_module_names: false
      long_list_align: inline
      empty_list_align: inherit
      list_padding: 4
      separate_lists: true
      space_surround: false

  - language_pragmas:
      style: vertical
      remove_redundant: true

  # Remove trailing whitespace
  - trailing_whitespace: {}

columns: 100

newline: native

language_extensions:
  - BangPatterns
  - ConstraintKinds
  - DataKinds
  - DefaultSignatures
  - DeriveAnyClass
  - DeriveDataTypeable
  - DeriveGeneric
  - DerivingStrategies
  - DerivingVia
  - ExplicitNamespaces
  - FlexibleContexts
  - FlexibleInstances
  - FunctionalDependencies
  - GADTs
  - GeneralizedNewtypeDeriving
  - InstanceSigs
  - KindSignatures
  - LambdaCase
  - MultiParamTypeClasses
  - MultiWayIf
  - NamedFieldPuns
  - NoImplicitPrelude
  - OverloadedStrings
  - QuasiQuotes
  - RecordWildCards
  - ScopedTypeVariables
  - StandaloneDeriving
  - TemplateHaskell
  - TupleSections
  - TypeApplications
  - TypeFamilies
  - ViewPatterns

Removing NoImplicitPrelude from the config allows stylish-haskell to work again.

nitinprakash96 commented 2 years ago

+1 for NoImplicitPrelude.

RitickMadaan commented 2 years ago

Same Unknown Extension issue for me as well. Appears for NoImplicitPrelude as well as NoMonomorphismRestriction. Any particular reason why this is happening ?

Mikolaj commented 2 years ago

@jaspervdj: thank you very much. When could we expect a release (if not soon, I'd set up a local checkout).

jaspervdj commented 2 years ago

Released in v0.14.3.0

Mikolaj commented 2 years ago

Thank you again. I tested and this problem is fixed. Stylish-haskell works great with type-level (*) taken from

import GHC.TypeLits

though it chokes at

import GHC.TypeLits (type (*))

with

Warning (stylish-haskell): stylish-haskell failed: <string>:16:48: error:
    parse error on input `*'

This is with GHC 9.0.2. Should I report that separately? Is that an error in a stylish-haskell dependency perhaps?

jaspervdj commented 2 years ago

@Mikolaj That seems like a separate issue, please create a new one -- FYI stylish-haskell is currently using GHC 9.2 as a parser (regardless of which GHC it is compiled with).

Mikolaj commented 2 years ago

Done: https://github.com/haskell/stylish-haskell/issues/414