packages feed

type-of-html 0.4.0.0 → 0.4.0.1

raw patch · 4 files changed

+17/−23 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Html: addAttributes :: (a ?> b) => Attribute -> (a > b) -> (a :> b)
- Html.Attribute: unsafe :: Int -> Addr# -> ByteString

Files

src/Html.hs view
@@ -84,7 +84,7 @@        # 'Table > 'Tr > a        ) page tds =-  div_A [A.class_ "qux", A.id_ "baz"]+  div_A (A.class_ "qux" <> A.id_ "baz")     ( div_ "foo"     # div_ "bar"     # table_ (tr_ tds)@@ -100,7 +100,7 @@ >>> i_ "&" <i>&amp;</i> ->>> div_A [A.id_ ">"] ()+>>> div_A (A.id_ ">") () <div id="&gt;"></div>  If you want to opt out, wrap your types into the 'Raw'@@ -160,7 +160,6 @@   , renderBuilder   , type (>)(..)   , type (:>)(..)-  , addAttributes   , type (#)(..)   , (#)   , type (?>)@@ -179,8 +178,6 @@ import Html.Element  import Html.Type--import Html.Attribute (addAttributes)  -- | Orphan show instances to faciliate ghci development. instance                     Document (a > b) => Show (a > b) where show = renderString
src/Html/Attribute.hs view
@@ -8,20 +8,9 @@ import Html.Type import Data.Semigroup import Data.ByteString.Builder-import GHC.Prim (Addr#)  import qualified Data.ByteString.Builder.Internal as U-import qualified Data.ByteString.Internal as U-import qualified Data.ByteString.Unsafe   as U -{-# INLINE unsafe #-}-unsafe :: Int -> Addr# -> U.ByteString-unsafe i addr = U.accursedUnutterablePerformIO (U.unsafePackAddressLen i addr)--{-# INLINE addAttributes #-}-addAttributes :: (a ?> b) => Attribute -> (a > b) -> (a :> b)-addAttributes xs (Child b) = WithAttributes xs b- {-# INLINE accept_ #-} accept_ :: Convert a => a -> Attribute accept_ x = Attribute $ U.byteStringCopy (unsafe 9 " accept=\""#) <> unConv (convert x) <> char7 '"'@@ -485,3 +474,7 @@ {-# INLINE wrap_ #-} wrap_ :: Convert a => a -> Attribute wrap_ x = Attribute $ U.byteStringCopy (unsafe 7 " wrap=\""#) <> unConv (convert x) <> char7 '"'++{-# INLINE addAttributes #-}+addAttributes :: (a ?> b) => Attribute -> (a > b) -> (a :> b)+addAttributes xs (Child b) = WithAttributes xs b
src/Html/Convert.hs view
@@ -11,9 +11,12 @@ import Data.String import GHC.TypeLits import Html.Type+import GHC.Prim (Addr#)  import Data.Char (ord) +import qualified Data.ByteString.Internal as U+import qualified Data.ByteString.Unsafe   as U import qualified Data.ByteString.Builder as B import qualified Data.ByteString.Builder.Prim as BP import qualified Data.ByteString.Builder.Internal as U@@ -21,6 +24,10 @@ import qualified Data.Text                   as T import qualified Data.Text.Encoding          as T +{-# INLINE unsafe #-}+unsafe :: Int -> Addr# -> U.ByteString+unsafe i addr = U.accursedUnutterablePerformIO (U.unsafePackAddressLen i addr)+ {-# INLINE escape #-} escape :: T.Text -> B.Builder escape = T.encodeUtf8BuilderEscaped $@@ -35,19 +42,15 @@      {-# INLINE c2w #-}     c2w = fromIntegral . ord-    +     {-# INLINE fixed4 #-}     fixed4 x = BP.liftFixedToBounded $ const x BP.>$<       BP.word8 BP.>*< BP.word8 BP.>*< BP.word8 BP.>*< BP.word8-     +     {-# INLINE fixed5 #-}     fixed5 x = BP.liftFixedToBounded $ const x BP.>$<       BP.word8 BP.>*< BP.word8 BP.>*< BP.word8 BP.>*< BP.word8 BP.>*< BP.word8 ---- {-| Convert a type efficienctly to different string like types.  Add   instances if you want use custom types in your document. @@ -117,3 +120,4 @@ instance KnownSymbol a => Convert (Proxy a) where   {-# INLINE convert #-}   convert = Converted . U.byteStringCopy . fromString . symbolVal+
type-of-html.cabal view
@@ -1,5 +1,5 @@ name:                 type-of-html-version:              0.4.0.0+version:              0.4.0.1 synopsis:             High performance type driven html generation. description:          This library makes most invalid html documents compile time errors and uses advanced type level features to realise compile time computations. license:              BSD3