Instances for Html
This commit is contained in:
parent
c229a01376
commit
6f4b09bb0a
@ -69,6 +69,8 @@ import Numeric.Natural.Instances as Import ()
|
||||
import System.Random as Import (Random)
|
||||
import Control.Monad.Random.Class as Import (MonadRandom(..))
|
||||
|
||||
import Text.Blaze.Instances as Import ()
|
||||
|
||||
|
||||
import Control.Monad.Trans.RWS (RWST)
|
||||
|
||||
|
||||
37
src/Text/Blaze/Instances.hs
Normal file
37
src/Text/Blaze/Instances.hs
Normal file
@ -0,0 +1,37 @@
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
module Text.Blaze.Instances
|
||||
(
|
||||
) where
|
||||
|
||||
import ClassyPrelude
|
||||
import Text.Blaze
|
||||
import qualified Text.Blaze.Renderer.Text as Text
|
||||
|
||||
import Text.Read (Read(..))
|
||||
|
||||
import Data.Hashable (Hashable(..))
|
||||
import Data.Aeson (ToJSON(..), FromJSON(..))
|
||||
import qualified Data.Aeson as Aeson
|
||||
|
||||
|
||||
instance Eq Markup where
|
||||
(==) = (==) `on` Text.renderMarkup
|
||||
|
||||
instance Ord Markup where
|
||||
compare = comparing Text.renderMarkup
|
||||
|
||||
instance Read Markup where
|
||||
readPrec = preEscapedLazyText <$> readPrec
|
||||
|
||||
instance Show Markup where
|
||||
showsPrec prec = showsPrec prec . Text.renderMarkup
|
||||
|
||||
instance Hashable Markup where
|
||||
hashWithSalt s = hashWithSalt s . Text.renderMarkup
|
||||
|
||||
instance ToJSON Markup where
|
||||
toJSON = Aeson.String . toStrict . Text.renderMarkup
|
||||
|
||||
instance FromJSON Markup where
|
||||
parseJSON = Aeson.withText "Html" $ return . preEscapedText
|
||||
Loading…
Reference in New Issue
Block a user