Skip to content

Commit

Permalink
HSE returns tyvarbinds in random orders. sort by span
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonidas Loucas committed Jul 3, 2020
1 parent 7d52035 commit 277fa18
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Floskell/Pretty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -686,10 +686,13 @@ prettyConDecls condecls = do
withOperatorFormattingV Declaration "|" (write "=") id
listV' Declaration "|" condecls


prettyForall :: (Annotated ast, Pretty ast) => [ast NodeInfo] -> Printer ()
prettyForall vars = do
write "forall "
inter space $ map pretty vars
inter space $ map pretty
$ sortBy
(\l r -> nodeInfoSpan (ann l) `compare` nodeInfoSpan (ann r)) vars
operator Type "."

prettyTypesig :: (Annotated ast, Pretty ast)
Expand Down Expand Up @@ -742,7 +745,9 @@ prettyForallAdv mtyvarbinds mcontext mtyvarbinds' mcontext' p = do
prettyForallContext layoutCt mtvb mct = do
forM_ mtvb $ \tyvarbinds -> do
write "forall "
inter space $ map pretty tyvarbinds
inter space $ map pretty
$ sortBy
(\l r -> nodeInfoSpan (ann l) `compare` nodeInfoSpan (ann r)) tyvarbinds
withOperatorFormattingV Type "." (write "." >> space) id
forM_ mct $ \context -> do
case context of
Expand Down

0 comments on commit 277fa18

Please sign in to comment.