Skip to content

AST differences with (at least) Typeable and sort-constraints  #451

@pbrisbin

Description

@pbrisbin

Is your bug specific to Fourmolu?

  • Yes, I've verified that Ormolu does not have this bug

It works in https://ormolu-live.tweag.io/, but most likely because sort-constraints isn't a thing.

Did you try it on the web app?

Putting in

  -- | Handler for serialized update action
  data BatchUpdateHandler m
    = forall a.
      (Typeable a, FromJSON a, HasCallStack) =>
      BatchUpdateHandler
        (BatchUpdateJob -> a -> m ())

With sort-constraints reproduces the bug. Without sort-constraints, it formats fine. Removing Typeable also makes it format fine.

Did you search for existing issues?

  • Yes, there are no open or closed issues related to my issue

Searched for sort-constraints and saw only one closed issue that looks unrelated.

Describe the bug

% fourmolu -i **/*.hs
Loaded config from: /home/patrick/code/freckle/megarepo/fourmolu.yaml
jobs/library/Freckle/Jobs/BatchUpdate.hs
@@ -250,6 +250,6 @@
  -- | Handler for serialized update action
  data BatchUpdateHandler m
    = forall a.
-     (Typeable a, FromJSON a, HasCallStack) =>
+     (FromJSON a, HasCallStack, Typeable a) =>
      BatchUpdateHandler
        (BatchUpdateJob -> a -> m ())

  AST of input and AST of formatted code differ.
    at jobs/library/Freckle/Jobs/BatchUpdate.hs:253:18-27
    at jobs/library/Freckle/Jobs/BatchUpdate.hs:253:30-41
  Please, consider reporting the bug.
  To format anyway, use --unsafe.
roster-management/library/Freckle/RosterManagement/Csv/Field.hs
@@ -37,6 +37,6 @@
    --
    -- We need the 'Proxy' so that we can easily identify the 's' in
    -- 'Coercible s t' during pattern-matching.
-   From :: (FromField s, Coercible s t) => Proxy s -> Text -> Field t
+   From :: (Coercible s t, FromField s) => Proxy s -> Text -> Field t
    -- | Either of two 'Field's with the same type
    Or :: Field t -> Field t -> Field t

  AST of input and AST of formatted code differ.
    at roster-management/library/Freckle/RosterManagement/Csv/Field.hs:40:12-20
    at roster-management/library/Freckle/RosterManagement/Csv/Field.hs:40:25-35
  Please, consider reporting the bug.
  To format anyway, use --unsafe.

Let me know what else you'd need to debug.

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