lspitzner / brittany

haskell source code formatter
GNU Affero General Public License v3.0
690 stars 72 forks source link

Comments on return value tuple gets messed up #307

Open itsfarseen opened 4 years ago

itsfarseen commented 4 years ago

Paste this into: https://hexagoxel.de/brittany/

doFuncDefine
  :: Type1
  -> String
  -> [SpanW (String, Type1)]
  -> Span
  -> [Func]
  -> Either Error ([Func]  -- Funcs Table with this function added in
                  ,[Symbol] -- Local Symbol Table
                  ,[Stmt] -> [Func]  -- Return function
                  )

Outputs:

doFuncDefine
  :: Type1
  -> String
  -> [SpanW (String, Type1)]
  -> Span
  -> [Func]
  -> Either Error ([  -- Funcs Table with this function added in
                    Func], [ -- Local Symbol Table
                            Symbol], [Stmt] -> [Func]  -- Return function
                                                     )
tfausak commented 4 years ago

Oof, that's rough. Things get a little better if you avoid the list type, but that's not practical.

# cat issue-307.hs 
doFuncDefine
  :: Type1
  -> String
  -> [SpanW (String, Type1)]
  -> Span
  -> [Func]
  -> Either Error (t Func  -- Funcs Table with this function added in
                  ,t Symbol -- Local Symbol Table
                  ,t Stmt -> t Func  -- Return function
                  )

# brittany issue-307.hs
doFuncDefine
  :: Type1
  -> String
  -> [SpanW (String, Type1)]
  -> Span
  -> [Func]
  -> Either Error (t Func  -- Funcs Table with this function added in
                         , t Symbol -- Local Symbol Table
                                   , t Stmt -> t Func)  -- Return function