stylish-haskell icon indicating copy to clipboard operation
stylish-haskell copied to clipboard

formatting values, rather than constructors

Open peterbecich opened this issue 1 year ago • 0 comments

Can Stylish Haskell format values?

I am trying to format this value:

psBool :: PSType
psBool = TypeInfo
    { _typePackage = "",
      _typeModule = "Prim",
      _typeName = "Boolean",
      _typeParameters = []
    }

It appears Stylish Haskell ignores it and does not format it.

Here is a constructor definition with a bunch of formatting problems:

-- | Basic info about a data type:
data TypeInfo (lang :: Language) = TypeInfo
  { -- | Hackage package
    _typePackage    :: !Text,
    -- | Full Module path
    _typeModule     :: !Text,  _typeName       :: !Text
    ,        _typeParameters :: ![TypeInfo lang]
  }
  deriving (Eq, Ord,       Show)

and Stylish Haskell formats it perfectly:

-- | Basic info about a data type:
data TypeInfo (lang :: Language)
  = TypeInfo
      { -- | Hackage package
        _typePackage    :: !Text
        -- | Full Module path
      , _typeModule     :: !Text
      , _typeName       :: !Text
      , _typeParameters :: ![TypeInfo lang]
      }
  deriving (Eq, Ord, Show)

stylish-haskell 0.14.4.0

Thank you

peterbecich avatar Mar 18 '23 23:03 peterbecich