diff --git a/src/Juvix/Compiler/Concrete/Pretty/Base.hs b/src/Juvix/Compiler/Concrete/Pretty/Base.hs index f4d59b4ea..3efd08c47 100644 --- a/src/Juvix/Compiler/Concrete/Pretty/Base.hs +++ b/src/Juvix/Compiler/Concrete/Pretty/Base.hs @@ -301,9 +301,7 @@ instance SingI s => PrettyCode (InductiveDef s) where ppConstructorBlock :: NonEmpty (InductiveConstructorDef s) -> Sem r (Doc Ann) ppConstructorBlock cs = - do - concatWith (\x y -> x <> softline <> kwPipe <+> y) - <$> mapM ppCode (toList cs) + vsep <$> mapM (fmap (kwPipe <+>) . ppCode) (toList cs) dotted :: Foldable f => f (Doc Ann) -> Doc Ann dotted = concatWith (surround kwDot) diff --git a/src/Juvix/Compiler/Concrete/Translation/FromSource.hs b/src/Juvix/Compiler/Concrete/Translation/FromSource.hs index beacc8d9a..25436fe4b 100644 --- a/src/Juvix/Compiler/Concrete/Translation/FromSource.hs +++ b/src/Juvix/Compiler/Concrete/Translation/FromSource.hs @@ -506,7 +506,9 @@ inductiveDef _inductiveBuiltin = do P. "" kw kwAssign P. " ParsecS r (InductiveParameter 'Parsed) diff --git a/test/Scope/Positive.hs b/test/Scope/Positive.hs index e268c64ef..11315aa1b 100644 --- a/test/Scope/Positive.hs +++ b/test/Scope/Positive.hs @@ -131,6 +131,10 @@ tests = "Inductive" $(mkRelDir ".") $(mkRelFile "Inductive.juvix"), + PosTest + "Pipes symbol as possible prefix for each data constructor" + $(mkRelDir ".") + $(mkRelFile "InductivePipes.juvix"), PosTest "Imports and qualified names" $(mkRelDir "Imports") diff --git a/tests/positive/InductivePipes.juvix b/tests/positive/InductivePipes.juvix new file mode 100644 index 000000000..b7a53d6af --- /dev/null +++ b/tests/positive/InductivePipes.juvix @@ -0,0 +1,9 @@ +module InductivePipes; + + type T := | t : T; + type T2 := + | t1 : T2 + | t2 : T2 + | t3 : T2; + +end ;