Heist-0.13的默认AttrSplices是什么?

时间:2013-09-15 15:30:58

标签: haskell haskell-snap-framework heist

我正在使用Heist开发一个项目,因为它最近升级到0.13版本, 我试了一下,发现原来的HeistConfig改变了很多。

data HeistConfig m = HeistConfig
    { hcInterpretedSplices :: Splices (I.Splice m)
        -- ^ Interpreted splices are the splices that Heist has always had.  They
        -- return a list of nodes and are processed at runtime.
    , hcLoadTimeSplices    :: Splices (I.Splice IO)
        -- ^ Load time splices are like interpreted splices because they return a
        -- list of nodes.  But they are like compiled splices because they are
        -- processed once at load time.  All of Heist's built-in splices should be
        -- used as load time splices.
    , hcCompiledSplices    :: Splices (C.Splice m)
        -- ^ Compiled splices return a DList of Chunks and are processed at load
        -- time to generate a runtime monad action that will be used to render the
        -- template.
    , hcAttributeSplices   :: Splices (AttrSplice m)
        -- ^ Attribute splices are bound to attribute names and return a list of
        -- attributes.
    , hcTemplateLocations  :: [TemplateLocation]
        -- ^ A list of all the locations that Heist should get its templates
    }

所以现在我不能再使用[]作为默认的Splices,因为有defaultInterpretedSplices和defaultLoadTimeSplices,我发现defaultAttrSplices只是错过了,所以我怎么定义它?

1 个答案:

答案 0 :(得分:2)

我认为没有内置的AttrSplices。您应该能够使用来自mempty的{​​{1}},return ()noSplices来绑定任何拼接。

Heist.SpliceAPISplices s的类型别名,只是包含在newtype中的SplicesM s ()State也是Monoid类型的实例,所以你可以在这里使用mempty。

Slices s