1

私は 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
    }

defaultInterpretedSplices と defaultLoadTimeSplices があるため、[] をデフォルトの Splices として使用できなくなりました。

4

1 に答える 1

2

組み込みの AttrSplices はないと思います。memptyreturn ()またはnoSplicesfromのいずれかを使用してスプライスをバインドできないはずですHeist.SpliceAPI

Splices sはnewtype でラップされ SplicesM s ()たの型エイリアスです。も Monoid 型クラスのインスタンスなので、ここで mempty を使用できます。StateSlices s

newtype SplicesM s a = SplicesM { unSplices :: State (Map Text s) a }
  deriving (Monad, MonadState (Map Text s))

type Splices s = SplicesM s ()

instance Monoid (Splices s) where
  mempty = noSplices
  mappend = unionWithS (\_ b -> b)
于 2013-09-15T20:22:10.480 に答える