Paste server written in Haskell. Fork of Hpaste, fully freedom and privacy respecting and generally improved. At the time of writing there's an instance at <http://paste.rel4tion.org>.

[[ 🗃 ^aoqmo toothpaste ]] :: [📥 Inbox] [📤 Outbox] [🐤 Followers] [🤝 Collaborators] [🛠 Commits]

Clone

HTTPS: git clone https://vervis.peers.community/repos/aoqmo

SSH: git clone USERNAME@vervis.peers.community:aoqmo

Branches

Tags

hpaste :: src / Hpaste / View /

Hlint.hs

{-# OPTIONS -Wall -fno-warn-name-shadowing #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}

-- | Show hlint suggestions.

module Hpaste.View.Hlint
 (viewHints
 ,viewSuggestions)
  where

import Hpaste.Types
import Hpaste.View.Html

import Data.List              (intersperse)
import Language.Haskell.HLint
import Prelude                hiding ((++))
import Text.Blaze.Html5       as H hiding (map)

-- | Show hlint hints for a Haskell paste.
viewHints :: [Hint] -> Html
viewHints = mapM_ showHint where
  showHint hint =
    section $
      pre ! aClass "hint" $ sequence_ $ intersperse br $ map toHtml lns
    where section = case hintType hint of
                      Ignore  -> \_ -> return ()
                      Warning -> warnNoTitleSection
                      Error   -> errorNoTitleSection
          lns = lines $ clean $ hintContent hint
          clean = dropWhile (==':') . dropWhile (/=':')

viewSuggestions :: [Suggestion] -> Html
viewSuggestions = viewHints . map toHint where
  toHint s = Hint (suggestionSeverity s)
                  (show s)
[See repo JSON]