diff --git a/Cabal/Distribution/Types/Dependency.hs b/Cabal/Distribution/Types/Dependency.hs
index 73a99e43b008d01c7756cbdb8abc7060dae430be..08d4779dfd37bfbd82d552e950183c9072207ba8 100644
--- a/Cabal/Distribution/Types/Dependency.hs
+++ b/Cabal/Distribution/Types/Dependency.hs
@@ -57,9 +57,9 @@ instance NFData Dependency where rnf = genericRnf
 
 instance Pretty Dependency where
     pretty (Dependency name ver sublibs) = pretty name
-                                       <+> optionalMonoid
-                                             (sublibs /= Set.singleton LMainLibName)
-                                             (PP.colon <+> PP.braces prettySublibs)
+                                       <<>> optionalMonoid
+                                            (sublibs /= Set.singleton LMainLibName)
+                                            (PP.colon <<>> PP.braces prettySublibs)
                                        <+> pretty ver
       where
         optionalMonoid True x = x
@@ -81,12 +81,40 @@ versionGuardMultilibs expr = do
   else
     expr
 
+-- |
+--
+-- >>> simpleParsec "mylib:sub" :: Maybe Dependency
+-- Just (Dependency (PackageName "mylib") AnyVersion (fromList [LSubLibName (UnqualComponentName "sub")]))
+--
+-- >>> simpleParsec "mylib:{sub1,sub2}" :: Maybe Dependency
+-- Just (Dependency (PackageName "mylib") AnyVersion (fromList [LSubLibName (UnqualComponentName "sub1"),LSubLibName (UnqualComponentName "sub2")]))
+--
+-- >>> simpleParsec "mylib:{ sub1 , sub2 }" :: Maybe Dependency
+-- Just (Dependency (PackageName "mylib") AnyVersion (fromList [LSubLibName (UnqualComponentName "sub1"),LSubLibName (UnqualComponentName "sub2")]))
+--
+-- >>> simpleParsec "mylib:{ sub1 , sub2 } ^>= 42" :: Maybe Dependency
+-- Just (Dependency (PackageName "mylib") (MajorBoundVersion (mkVersion [42])) (fromList [LSubLibName (UnqualComponentName "sub1"),LSubLibName (UnqualComponentName "sub2")]))
+--
+-- Spaces around colon are not allowed:
+--
+-- >>> simpleParsec "mylib: sub" :: Maybe Dependency
+-- Nothing
+--
+-- >>> simpleParsec "mylib :sub" :: Maybe Dependency
+-- Nothing
+--
+-- >>> simpleParsec "mylib: {sub1,sub2}" :: Maybe Dependency
+-- Nothing
+--
+-- >>> simpleParsec "mylib :{sub1,sub2}" :: Maybe Dependency
+-- Nothing
+--
 instance Parsec Dependency where
     parsec = do
-        name <- lexemeParsec
+        name <- parsec
 
         libs <- option [LMainLibName]
-              $ (char ':' *> spaces *>)
+              $ (char ':' *>)
               $ versionGuardMultilibs
               $ pure <$> parseLib name <|> parseMultipleLibs name
 
diff --git a/Cabal/tests/ParserTests/regressions/issue-5846.format b/Cabal/tests/ParserTests/regressions/issue-5846.format
index 7ddb6afaee1a27d3afa4292e1039af94b97de83e..bd742612afd95bd5995bdeee5e1c5fde7a5cf677 100644
--- a/Cabal/tests/ParserTests/regressions/issue-5846.format
+++ b/Cabal/tests/ParserTests/regressions/issue-5846.format
@@ -5,7 +5,7 @@ version:       5846
 library
     default-language: Haskell2010
     build-depends:
-        lib1 : {a, b} -any,
-        lib2 : {c} -any,
-        lib3 : {d} >=1,
-        lib4 : {a, b} >=1
+        lib1:{a, b} -any,
+        lib2:{c} -any,
+        lib3:{d} >=1,
+        lib4:{a, b} >=1
diff --git a/cabal-testsuite/PackageTests/MultipleLibraries/cabal.out b/cabal-testsuite/PackageTests/MultipleLibraries/cabal.out
index 7e51c00ef041efef4289af30248ad301673f3ada..78899c26837f3d2a98f98386fd19391183c33b24 100644
--- a/cabal-testsuite/PackageTests/MultipleLibraries/cabal.out
+++ b/cabal-testsuite/PackageTests/MultipleLibraries/cabal.out
@@ -9,4 +9,4 @@ Preprocessing library 'privatelib' for d-0.1.0.0..
 Building library 'privatelib' for d-0.1.0.0..
 Configuring library for p-0.1.0.0..
 cabal: Encountered missing or private dependencies:
-    d : {privatelib} ==0.1.0.0
+    d:{privatelib} ==0.1.0.0