hsp 0.6.1 → 0.7.0
raw patch · 3 files changed
+28/−24 lines, 3 filesdep ~HJScriptdep ~hsx
Dependency ranges changed: HJScript, hsx
Files
- hsp.cabal +9/−5
- src/HSP/HJScript.hs +8/−8
- src/HSP/XMLGenerator.hs +11/−11
hsp.cabal view
@@ -1,9 +1,9 @@ Name: hsp-Version: 0.6.1+Version: 0.7.0 License: BSD3 License-File: LICENSE Author: Niklas Broberg, Joel Bjornson-Maintainer: Niklas Broberg <niklas.broberg@chalmers.se>+Maintainer: Niklas Broberg <niklas.broberg@gmail.com> Stability: Experimental Category: Web, Language@@ -18,15 +18,19 @@ * A cgi-handler utility (as a separate package, hsp-cgi) . For details on usage, please see the website, and the author's thesis.-Homepage: http://code.haskell.org/HSP/hsp+Homepage: http://patch-tag.com/r/nibro/hsp Build-Type: Simple-Cabal-Version: >= 1.2.3+Cabal-Version: >= 1.6 Tested-With: GHC==6.8.3, GHC==6.10, GHC==7.0.2 +source-repository head+ type: darcs+ location: http://patch-tag.com/r/nibro/hsp+ Flag base4 Library- Build-Depends: base >3 && < 5, mtl, harp, hsx>=0.7.0, HJScript>=0.5.0, text+ Build-Depends: base >3 && < 5, mtl, harp, hsx>=0.10.0 && < 0.11, HJScript>=0.6.0, text if flag(base4) Build-depends: base >= 4 && < 5 cpp-options: -DBASE4
src/HSP/HJScript.hs view
@@ -7,7 +7,7 @@ import HSP.XMLGenerator import HJScript -- hiding (( := )(..), genElement, genEElement, asAttr, asChild) -import qualified HSX.XMLGenerator as HSX +import {- qualified -} HSX.XMLGenerator -- as HSX instance Monad m => EmbedAsChild (HSPT' m) (Block t) where asChild b = asChild $ @@ -24,7 +24,7 @@ instance Monad m => IsAttrValue m (HJScript (Exp t)) where toAttrValue script = toAttrValue $ evaluateHJScript script -scriptAsChild :: (EmbedAsChild m (Block ())) => HJScript () -> XMLGenT m [HSX.Child m] +scriptAsChild :: (EmbedAsChild m (Block ())) => HJScript () -> XMLGenT m [ChildType m] scriptAsChild script = asChild $ snd $ evalHJScript script newGlobalVar :: HSP (Var t, Block ()) @@ -76,21 +76,21 @@ -- Settting properties ------------------------------------------------- -setId :: (HSX.SetAttr m xml, HSX.EmbedAsAttr m (Attr String v)) - => xml -> v -> HSX.XMLGenT m (HSX.XML m) +setId :: (SetAttr m xml, EmbedAsAttr m (Attr String v)) + => xml -> v -> XMLGenT m (XMLType m) setId e v = e `set` ("id" := v) -- Generel method for adding 'onEvent' attributes to XML elements. -onEvent :: (HSX.SetAttr m xml, HSX.EmbedAsAttr m (Attr String (HJScript t))) - => Event -> xml -> HJScript t -> HSX.XMLGenT m (HSX.XML m) +onEvent :: (SetAttr m xml, EmbedAsAttr m (Attr String (HJScript t))) + => Event -> xml -> HJScript t -> XMLGenT m (XMLType m) onEvent event xml script = xml `set` (showEvent event := script) onAbort, onBlur, onChange, onClick, onDblClick, onError, onFocus, onKeyDown, onKeyPress, onKeyUp, onLoad, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp, onReset, onResize, onSelect, onSubmit, onUnload :: - (HSX.SetAttr m xml, HSX.EmbedAsAttr m (Attr String (HJScript t))) - => xml -> HJScript t -> HSX.XMLGenT m (HSX.XML m) + (SetAttr m xml, EmbedAsAttr m (Attr String (HJScript t))) + => xml -> HJScript t -> XMLGenT m (XMLType m) onAbort = onEvent OnAbort onBlur = onEvent OnBlur
src/HSP/XMLGenerator.hs view
@@ -9,15 +9,15 @@ extract, - module HSX.XMLGenerator, HSX.genElement, HSX.genEElement + module HSX.XMLGenerator, genElement, genEElement ) where import HSP.Monad import HSP.XML hiding (Name) -import HSX.XMLGenerator hiding (XMLGen(..)) -import qualified HSX.XMLGenerator as HSX (XMLGen(..)) +import HSX.XMLGenerator --hiding (XMLGen(..)) +--import qualified HSX.XMLGenerator as HSX (XMLGen(..)) --import Control.Monad (liftM) import Control.Monad.Trans (lift) @@ -30,12 +30,12 @@ -- Instantiating XMLGenerator for the HSP monad. -- | We can use literal XML syntax to generate values of type XML in the HSP monad. -instance Monad m => HSX.XMLGen (HSPT' m) where - type HSX.XML (HSPT' m) = XML - newtype HSX.Attribute (HSPT' m) = HSPAttr Attribute - newtype HSX.Child (HSPT' m) = HSPChild XML +instance Monad m => XMLGen (HSPT' m) where + type XMLType (HSPT' m) = XML + newtype AttributeType (HSPT' m) = HSPAttr Attribute + newtype ChildType (HSPT' m) = HSPChild XML xmlToChild = HSPChild - pcdataToChild = HSX.xmlToChild . pcdata + pcdataToChild = xmlToChild . pcdata genElement = element genEElement = eElement @@ -172,7 +172,7 @@ -- This instance should already be there, probably doesn't work due -- to type families not being fully supported yet. instance Monad m => EmbedAsChild (HSPT' m) XML where - asChild = return . return . HSX.xmlToChild + asChild = return . return . xmlToChild --------------- -- IsAttrValue @@ -377,9 +377,9 @@ (CDATA e1 s1, CDATA e2 s2) | e1 == e2 -> flP (CDATA e1 (s1++s2) : xs) bs _ -> flP (y:xs) (x:bs) -stripAttr :: HSX.Attribute (HSPT' m) -> Attribute +stripAttr :: AttributeType (HSPT' m) -> Attribute stripAttr (HSPAttr a) = a -stripChild :: HSX.Child (HSPT' m) -> XML +stripChild :: ChildType (HSPT' m) -> XML stripChild (HSPChild c) = c eAttrs :: Attributes