git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Don't sort alphabetically
bf361cdGary Burgess
psc-docs/Main.hs+5−6
@@ -18,7 +18,6 @@ import Control.Applicative
18import Control.Monad
18import Control.Monad
19import Control.Monad.Writer
19import Control.Monad.Writer
20import Control.Arrow (first)
20import Control.Arrow (first)
21−import Data.Function (on)
22import Data.List
21import Data.List
23import Data.Maybe (fromMaybe)
22import Data.Maybe (fromMaybe)
24import Data.Version (showVersion)
23import Data.Version (showVersion)
@@ -113,7 +112,7 @@ renderModule showHierarchy mdl@(P.Module moduleName _ exps) =
113 spacer
112 spacer
114
113
115renderTopLevel :: Maybe [P.DeclarationRef] -> [P.Declaration] -> Docs
114renderTopLevel :: Maybe [P.DeclarationRef] -> [P.Declaration] -> Docs
116−renderTopLevel exps decls = forM_ (sortBy (compare `on` getName) decls) $ \decl -> do
115+renderTopLevel exps decls = forM_ decls $ \decl -> do
117 traverse_ (headerLevel 4) (ticks `fmap` getDeclarationTitle decl)
116 traverse_ (headerLevel 4) (ticks `fmap` getDeclarationTitle decl)
118 spacer
117 spacer
119 renderDeclaration exps decl
118 renderDeclaration exps decl
@@ -181,19 +180,19 @@ renderDeclaration _ _ = return ()
181renderComments :: [P.Comment] -> Docs
180renderComments :: [P.Comment] -> Docs
182renderComments cs = do
181renderComments cs = do
183 let raw = concatMap toLines cs
182 let raw = concatMap toLines cs
184−
183+
185 if all hasPipe raw
184 if all hasPipe raw
186 then atIndent 0 . unlines . map stripPipes $ raw
185 then atIndent 0 . unlines . map stripPipes $ raw
187 else atIndent 4 $ unlines raw
186 else atIndent 4 $ unlines raw
188−
187+
189 unless (null raw) spacer
188 unless (null raw) spacer
190 where
189 where
191
190
192 toLines (P.LineComment s) = [s]
191 toLines (P.LineComment s) = [s]
193 toLines (P.BlockComment s) = lines s
192 toLines (P.BlockComment s) = lines s
194−
193+
195 hasPipe s = case dropWhile (== ' ') s of { ('|':_) -> True; _ -> False }
194 hasPipe s = case dropWhile (== ' ') s of { ('|':_) -> True; _ -> False }
196−
195+
197 stripPipes = dropPipe . dropWhile (== ' ')
196 stripPipes = dropPipe . dropWhile (== ' ')
198
197
199 dropPipe ('|':' ':s) = s
198 dropPipe ('|':' ':s) = s