diff --git a/HLint.hs b/HLint.hs index 0386f6ffd..1ac62bf71 100644 --- a/HLint.hs +++ b/HLint.hs @@ -2,6 +2,8 @@ import "hint" HLint.Default import "hint" HLint.Dollar import "hint" HLint.Generalise +ignore "Use mappend" +error "generalize ++" = (++) ==> (<>) -- AMP fallout error "generalize mapM" = mapM ==> traverse error "generalize mapM_" = mapM_ ==> traverse_ diff --git a/src/Alignment.hs b/src/Alignment.hs index 59ecab355..d9078a644 100644 --- a/src/Alignment.hs +++ b/src/Alignment.hs @@ -133,11 +133,11 @@ alignChildren getRange (first:rest) headRanges | ~(l, r) <- splitThese first = case intersectionsWithHeadRanges first of -- It intersects on both sides, so we can just take the first line whole. - (True, True) -> ((++) <$> toTerms first <*> firstRemaining, restRemaining) + (True, True) -> ((<>) <$> toTerms first <*> firstRemaining, restRemaining) -- It only intersects on the left, so split it up. - (True, False) -> ((++) <$> toTerms (fromJust l) <*> firstRemaining, maybe identity (:) r restRemaining) + (True, False) -> ((<>) <$> toTerms (fromJust l) <*> firstRemaining, maybe identity (:) r restRemaining) -- It only intersects on the right, so split it up. - (False, True) -> ((++) <$> toTerms (fromJust r) <*> firstRemaining, maybe identity (:) l restRemaining) + (False, True) -> ((<>) <$> toTerms (fromJust r) <*> firstRemaining, maybe identity (:) l restRemaining) -- It doesn’t intersect at all, so skip it and move along. (False, False) -> (firstRemaining, first:restRemaining) | otherwise = alignChildren getRange rest headRanges diff --git a/src/Parser.hs b/src/Parser.hs index eef533422..8ac8e9070 100644 --- a/src/Parser.hs +++ b/src/Parser.hs @@ -42,7 +42,7 @@ termConstructor source info = cofree . construct where withDefaultInfo syntax = (info :< syntax) construct :: [Term Text Info] -> CofreeF (S.Syntax Text) Info (Term Text Info) - construct [] = withDefaultInfo $ S.Leaf . pack . toString $ slice (characterRange info) source + construct [] = withDefaultInfo . S.Leaf . pack . toString $ slice (characterRange info) source construct children | Assignment == category info = case children of (identifier:value:[]) -> withDefaultInfo $ S.Assignment identifier value construct children | MathAssignment == category info = case children of diff --git a/src/Range.hs b/src/Range.hs index 206f7c38e..57984634c 100644 --- a/src/Range.hs +++ b/src/Range.hs @@ -35,7 +35,7 @@ rangesAndWordsFrom startIndex string = fromMaybe [] $ take isWord <|> take isPun endFor parsed = startIndex + length parsed parse transform predicate = case span predicate string of ([], _) -> Nothing - (parsed, rest) -> Just $ maybe identity (:) (transform parsed) $ rangesAndWordsFrom (endFor parsed) rest + (parsed, rest) -> Just . maybe identity (:) (transform parsed) $ rangesAndWordsFrom (endFor parsed) rest -- | Is this a word character? -- | Word characters are defined as in [Ruby’s `\p{Word}` syntax](http://ruby-doc.org/core-2.1.1/Regexp.html#class-Regexp-label-Character+Properties), i.e.: -- | > A member of one of the following Unicode general category _Letter_, _Mark_, _Number_, _Connector_Punctuation_ diff --git a/src/Renderer/Split.hs b/src/Renderer/Split.hs index 012f0e3ab..43c5cf584 100644 --- a/src/Renderer/Split.hs +++ b/src/Renderer/Split.hs @@ -80,7 +80,7 @@ split diff blobs = TL.toStrict . renderHtml . docTypeHtml . ((head $ link ! A.rel "stylesheet" ! A.href "style.css") <>) . body - . (table ! A.class_ (stringValue "diff")) $ + . (table ! A.class_ (stringValue "diff")) . ((colgroup $ (col ! A.width (stringValue . show $ columnWidth)) <> col <> (col ! A.width (stringValue . show $ columnWidth)) <> col) <>) . mconcat $ numberedLinesToMarkup <$> numbered where @@ -158,7 +158,7 @@ instance ToMarkup (Renderable (Source Char, Term a Info)) where toMarkup (Renderable (source, term)) = Prologue.fst $ cata (\ (info :< syntax) -> (toMarkup $ Renderable (source, info, syntax), characterRange info)) term instance ToMarkup (Renderable (Source Char, SplitDiff a Info)) where - toMarkup (Renderable (source, diff)) = Prologue.fst $ iter (\ (info :< syntax) -> (toMarkup $ Renderable (source, info, syntax), characterRange info)) $ toMarkupAndRange <$> diff + toMarkup (Renderable (source, diff)) = Prologue.fst . iter (\ (info :< syntax) -> (toMarkup $ Renderable (source, info, syntax), characterRange info)) $ toMarkupAndRange <$> diff where toMarkupAndRange :: SplitPatch (Term a Info) -> (Markup, Range) toMarkupAndRange patch = let term@(info :< _) = runCofree $ getSplitTerm patch in ((div ! A.class_ (splitPatchToClassName patch) ! A.data_ (stringValue (show (unSize (size info))))) . toMarkup $ Renderable (source, cofree term), characterRange info)