packages feed

heist 0.13.0.6 → 0.13.1

raw patch · 4 files changed

+56/−11 lines, 4 filesdep ~dlistdep ~process

Dependency ranges changed: dlist, process

Files

heist.cabal view
@@ -1,5 +1,5 @@ name:           heist-version:        0.13.0.6+version:        0.13.1 synopsis:       An Haskell template system supporting both HTML5 and XML. description:     Heist is a powerful template system that supports both HTML5 and XML.@@ -148,12 +148,12 @@     containers                 >= 0.2     && < 0.6,     directory                  >= 1.1     && < 1.3,     directory-tree             >= 0.10    && < 0.12,-    dlist                      >= 0.5     && < 0.7,+    dlist                      >= 0.5     && < 0.8,     errors                     >= 1.4     && < 1.5,     filepath                   >= 1.3     && < 1.4,     hashable                   >= 1.1     && < 1.3,     mtl                        >= 2.0     && < 2.2,-    process                    >= 1.1     && < 1.2,+    process                    >= 1.1     && < 1.3,     random                     >= 1.0.1.0 && < 1.1,     text                       >= 0.10    && < 1.2,     time                       >= 1.1     && < 1.5,
src/Heist/Compiled/Internal.hs view
@@ -641,6 +641,26 @@   ------------------------------------------------------------------------------+-- | More powerful version of manyWithSplices that lets you also define+-- attribute splices.+manyWith :: (Monad n)+         => Splice n+         -> Splices (RuntimeSplice n a -> Splice n)+         -> Splices (RuntimeSplice n a -> AttrSplice n)+         -> RuntimeSplice n [a]+         -> Splice n+manyWith splice splices attrSplices runtimeAction = do+    p <- newEmptyPromise+    let splices' = mapS ($ getPromise p) splices+    let attrSplices' = mapS ($ getPromise p) attrSplices+    chunks <- withLocalSplices splices' attrSplices' splice+    return $ yieldRuntime $ do+        items <- runtimeAction+        res <- forM items $ \item -> putPromise p item >> codeGen chunks+        return $ mconcat res+++------------------------------------------------------------------------------ -- | Similar to 'mapSplices' in interpreted mode.  Gets a runtime list of -- items and applies a compiled runtime splice function to each element of the -- list.
src/Heist/SpliceAPI.hs view
@@ -25,6 +25,7 @@  module Heist.SpliceAPI where +import           Control.Applicative import           Control.Monad.State (State, MonadState, execState, modify) import           Data.Map (Map) import qualified Data.Map as M@@ -36,7 +37,7 @@ ------------------------------------------------------------------------------ -- | A monad providing convenient syntax for defining splices. newtype SplicesM s a = SplicesM { unSplices :: State (Map Text s) a }-  deriving (Monad, MonadState (Map Text s))+  deriving (Functor, Applicative, Monad, MonadState (Map Text s))   ------------------------------------------------------------------------------
src/Heist/Types.hs view
@@ -2,13 +2,13 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE PackageImports #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE UndecidableInstances #-}+{-# LANGUAGE CPP #-}  {-| -This module contains the core Heist data types.  +This module contains the core Heist data types.  Edward Kmett wrote most of the HeistT monad code and associated instances, liberating us from the unused writer portion of RWST.@@ -68,7 +68,11 @@ data DocumentFile = DocumentFile     { dfDoc  :: X.Document     , dfFile :: Maybe FilePath-    } deriving (Eq)+    } deriving ( Eq+#if MIN_VERSION_base(4,7,0)+               , Typeable+#endif+               )   ------------------------------------------------------------------------------@@ -85,7 +89,11 @@                , Monad                , MonadIO                , MonadState HeterogeneousEnvironment-               , MonadTrans )+               , MonadTrans+#if MIN_VERSION_base(4,7,0)+               , Typeable+#endif+               )   ------------------------------------------------------------------------------@@ -106,7 +114,9 @@                -- ^ output computed at run time              | RuntimeAction !(RuntimeSplice m ())                -- ^ runtime action used only for its side-effect-+#if MIN_VERSION_base(4,7,0)+             deriving Typeable+#endif  instance Show (Chunk m) where     show (Pure _) = "Pure"@@ -175,9 +185,13 @@     -- | This is needed because compiled templates are generated with a bunch     -- of calls to renderFragment rather than a single call to render.     , _curMarkup           :: Markup+#if MIN_VERSION_base(4,7,0)+} deriving (Typeable)+#else }-+#endif +#if !MIN_VERSION_base(4,7,0) -- NOTE: We got rid of the Monoid instance because it is absolutely not safe -- to combine two compiledTemplateMaps.  All compiled templates must be known -- at load time and processed in a single call to initHeist/loadTemplates or@@ -186,6 +200,7 @@ instance (Typeable1 m) => Typeable (HeistState m) where     typeOf _ = mkTyConApp templateStateTyCon [typeOf1 (undefined :: m ())] +#endif  ------------------------------------------------------------------------------ -- | HeistT is the monad transformer used for splice processing.  HeistT@@ -205,7 +220,11 @@     runHeistT :: X.Node               -> HeistState n               -> m (a, HeistState n)+#if MIN_VERSION_base(4,7,0)+} deriving Typeable+#else }+#endif   ------------------------------------------------------------------------------@@ -232,13 +251,16 @@ compiledSpliceNames ts = H.keys $ _compiledSpliceMap ts  +#if !MIN_VERSION_base(4,7,0) ------------------------------------------------------------------------------ -- | The Typeable instance is here so Heist can be dynamically executed with -- Hint. templateStateTyCon :: TyCon templateStateTyCon = mkTyCon "Heist.HeistState" {-# NOINLINE templateStateTyCon #-}+#endif + ------------------------------------------------------------------------------ -- | Evaluates a template monad as a computation in the underlying monad. evalHeistT :: (Monad m)@@ -380,6 +402,7 @@     callCC = liftCallCC callCC  +#if !MIN_VERSION_base(4,7,0) ------------------------------------------------------------------------------ -- | The Typeable instance is here so Heist can be dynamically executed with -- Hint.@@ -389,6 +412,7 @@  instance (Typeable1 m) => Typeable1 (HeistT n m) where     typeOf1 _ = mkTyConApp templateMonadTyCon [typeOf1 (undefined :: m ())]+#endif   ------------------------------------------------------------------------------@@ -409,7 +433,7 @@ -- Hamlet's speech.  @liftM (getAttribute \"author\") getParamNode@ would -- return @Just "Shakespeare"@. getParamNode :: Monad m => HeistT n m X.Node-getParamNode = HeistT $ \r s -> return (r,s)+getParamNode = HeistT $ curry return {-# INLINE getParamNode #-}