Skip to content

Misformats hanging kind signatures #749

@robx

Description

@robx

Describe the bug

With hanging kind signatures

data Thing
  :: Type
  -> Type

ormolu formats to unparseable code.

To Reproduce

$ cat test.hs
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}

module Vec where

import Data.Kind

data Ze
data Su n

data Vec
  :: Type
  -> Type
  -> Type
  where
    Nil  :: Vec a Ze
    Cons :: a -> Vec a n -> Vec a (Su n)

$ ormolu test.hs
test.hs:13:1
  Parsing of formatted code failed:  parse error (possibly incorrect indentation or mismatched brackets)
$ ormolu -u test.hs
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}

module Vec where

import Data.Kind

data Ze

data Su n

data Vec :: Type ->
Type ->
Type where
  Nil :: Vec a Ze
  Cons :: a -> Vec a n -> Vec a (Su n)

Expected behavior
The code should be formatted to parseable code (with the same AST).

Environment
current master (post-0.2) on macos

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions