ihp-hsx 0.20.0 → 1.0.0
raw patch · 4 files changed
+17/−3 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ IHP.HSX.QQ: instance IHP.HSX.QQ.ApplyAttribute Text.Blaze.Internal.AttributeValue
Files
- IHP/HSX/ConvertibleStrings.hs +0/−0
- IHP/HSX/HsExpToTH.hs +9/−1
- IHP/HSX/QQ.hs +7/−1
- ihp-hsx.cabal +1/−1
IHP/HSX/ConvertibleStrings.hs view
IHP/HSX/HsExpToTH.hs view
@@ -14,6 +14,7 @@ import GHC.Hs.Extension as Ext import GHC.Hs.Pat as Pat import GHC.Hs.Lit+import qualified GHC.Hs.Utils as Utils import qualified Data.ByteString as B import qualified Language.Haskell.TH.Syntax as TH import GHC.Types.SrcLoc@@ -28,6 +29,7 @@ import qualified Data.List.NonEmpty as NonEmpty import Language.Haskell.Syntax.Type + fl_value = rationalFromFractionalLit toLit :: HsLit GhcPs -> TH.Lit@@ -63,8 +65,8 @@ toName n = case n of (Unqual o) -> TH.mkName (occNameString o) (Qual m o) -> TH.mkName (Module.moduleNameString m <> "." <> occNameString o)+ (Exact name) -> TH.mkName ((occNameString . rdrNameOcc . getRdrName) name) --error "exact" (Orig _ _) -> error "orig"- (Exact _) -> error "exact" toFieldExp :: a toFieldExp = undefined@@ -72,6 +74,12 @@ toPat :: Pat.Pat GhcPs -> TH.Pat toPat (Pat.VarPat _ (unLoc -> name)) = TH.VarP (toName name) toPat (TuplePat _ p _) = TH.TupP (map (toPat . unLoc) p)+toPat (ParPat xP lP) = (toPat . unLoc) lP+toPat (ConPat pat_con_ext ((unLoc -> name)) pat_args) = TH.ConP (toName name) (map toType []) (map (toPat . unLoc) (Pat.hsConPatArgs pat_args))+toPat (ViewPat pat_con pat_args pat_con_ext) = error "TH.ViewPattern not implemented"+toPat (SumPat _ _ _ _) = error "TH.SumPat not implemented"+toPat (WildPat _ ) = error "TH.WildPat not implemented"+toPat (NPat _ _ _ _ ) = error "TH.NPat not implemented" toPat p = todo "toPat" p toExp :: Expr.HsExpr GhcPs -> TH.Exp
IHP/HSX/QQ.hs view
@@ -93,6 +93,7 @@ spreadAttributes :: ApplyAttribute value => [(Text, value)] -> Html5.Html -> Html5.Html spreadAttributes attributes html = applyAttributes html $ map (\(name, value) -> applyAttribute name (" " <> name <> "=\"") value) attributes+{-# INLINE spreadAttributes #-} applyAttributes :: Html5.Html -> [Html5.Html -> Html5.Html] -> Html5.Html applyAttributes element attributes = foldl' (\element attribute -> attribute element) element attributes@@ -122,9 +123,14 @@ instance ApplyAttribute attribute => ApplyAttribute (Maybe attribute) where applyAttribute attr attr' (Just value) h = applyAttribute attr attr' value h applyAttribute attr attr' Nothing h = h+ {-# INLINE applyAttribute #-} +instance ApplyAttribute Html5.AttributeValue where+ applyAttribute attr attr' value h = h ! (attribute (Html5.textTag attr) (Html5.textTag attr') value)+ {-# INLINE applyAttribute #-}+ instance {-# OVERLAPPABLE #-} ConvertibleStrings value Html5.AttributeValue => ApplyAttribute value where- applyAttribute attr attr' value h = h ! (attribute (Html5.textTag attr) (Html5.textTag attr') (cs value))+ applyAttribute attr attr' value h = applyAttribute attr attr' ((cs value) :: Html5.AttributeValue) h {-# INLINE applyAttribute #-} instance Show (MarkupM ()) where
ihp-hsx.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: ihp-hsx-version: 0.20.0+version: 1.0.0 synopsis: JSX-like but for Haskell description: JSX-like templating syntax for Haskell license: MIT