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

DataTypes style

Open wdanilo opened this issue 10 years ago • 2 comments

Hello! It would be great to add option to style DataTypes and other structures, for example:

data Point = Point
    { pointX :: Double, pointY :: Double
    , pointName :: String
    } 
    deriving (Show)

should be changed to the following (or simmilar):

data Point = Point { pointX    :: Double
                   , pointY    :: Double
                   , pointName :: String
                   } deriving (Show)

Additional the ability to enable or disable some pretification parts would be very usefull - for example, some users would not like to put types in the same column (like in my example)

wdanilo avatar Dec 03 '13 15:12 wdanilo

...or even having the trailing } deriving (Show) on the same line as pointName?

dsvensson avatar Sep 06 '17 08:09 dsvensson

Hi, we've recently added a feature to format record syntax (https://github.com/jaspervdj/stylish-haskell/pull/256). It works a bit different than what you've proposed, but an option can be added to adhere to your proposal.

EncodePanda avatar Jan 23 '20 17:01 EncodePanda