1
1
mirror of https://github.com/anoma/juvix.git synced 2025-01-06 06:53:33 +03:00

[pretty] improve where block printing

This commit is contained in:
Jan Mas Rovira 2022-01-25 13:23:05 +01:00
parent c9ac6b8c5a
commit 5580b563f4

View File

@ -394,13 +394,14 @@ ppFunctionClause FunctionClause {..} = do
Nothing -> return Nothing
Just ne -> Just . hsep . toList <$> mapM ppPattern ne
clauseBody' <- ppExpression clauseBody
clauseWhere' <- sequence $ ppWhereBlock <$> clauseWhere
clauseWhere' <- sequence (ppWhereBlock <$> clauseWhere)
return $
clauseOwnerFunction' <+?> clausePatterns' <+> kwAssignment <+> clauseBody'
<+?> (((line <> kwWhere) <+>) <$> clauseWhere')
<+?> ((line <>) <$> clauseWhere')
where
ppWhereBlock :: WhereBlock 'Scoped -> Sem r (Doc Ann)
ppWhereBlock WhereBlock {..} = ppBlock ppWhereClause whereClauses
ppWhereBlock WhereBlock {..} =
ppBlock ppWhereClause whereClauses >>= indented . (kwWhere <+>)
where
ppWhereClause :: WhereClause 'Scoped -> Sem r (Doc Ann)
ppWhereClause c = case c of