1

Heist の使用方法を理解しようとしていますが、見つけた例はどれも機能していないようで、私と同じ問題を抱えている人を他に見つけることができないようです。ここでいくつかのサンプルコードを見つけました:

https://www.schoolofhaskell.com/school/to-infinity-and-beyond/older-but-still-interesting/compiled-heist-insight-with-no-snap-in-sight

ただし、最初の例を実行しようとすると、次のエラーが発生します。

Main.hs:20:15:
    ‘hcCompiledSplices’ is not a record selector
    In the expression:
    mempty
        {hcCompiledSplices = "foo" ## splice,
        hcTemplateLocations = [loadTemplates "."]}
    In an equation for ‘heistConfig’:
        heistConfig
        = mempty
            {hcCompiledSplices = "foo" ## splice,
            hcTemplateLocations = [loadTemplates "."]}
    In the expression:
    do { let heistConfig = ...;
        heistState <- either (error "oops") id
                        <$> (runEitherT $ initHeist heistConfig);
        builder <- maybe (error "oops") fst
                    $ renderTemplate heistState "simple";
        toByteStringIO B.putStr builder }

Main.hs:22:15:
    ‘hcTemplateLocations’ is not a record selector
    In the expression:
    mempty
        {hcCompiledSplices = "foo" ## splice,
        hcTemplateLocations = [loadTemplates "."]}
    In an equation for ‘heistConfig’:
        heistConfig
        = mempty
            {hcCompiledSplices = "foo" ## splice,
            hcTemplateLocations = [loadTemplates "."]}
    In the expression:
    do { let heistConfig = ...;
        heistState <- either (error "oops") id
                        <$> (runEitherT $ initHeist heistConfig);
        builder <- maybe (error "oops") fst
                    $ renderTemplate heistState "simple";
        toByteStringIO B.putStr builder }

私は何を間違っていますか?

4

1 に答える 1