Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove manyWithPureSplices because it doesn't make sense

  • Loading branch information...
commit aef0048dad3a97d7e590b5bcd7efc796dc7511cc 1 parent e5f2fd3
@mightybyte mightybyte authored
Showing with 9 additions and 14 deletions.
  1. +0 −1  src/Heist/Compiled.hs
  2. +9 −13 src/Heist/Compiled/Internal.hs
View
1  src/Heist/Compiled.hs
@@ -35,7 +35,6 @@ module Heist.Compiled
, withSplices
, manyWithSplices
, withPureSplices
- , manyWithPureSplices
-- * Old compiled splice API
, mapPromises
View
22 src/Heist/Compiled/Internal.hs
@@ -744,10 +744,19 @@ withSplices splice splices runtimeAction = do
return $ fillPromise `mappend` chunks
+------------------------------------------------------------------------------
+-- | Gets a list of items at runtime, then for each item it runs the splice
+-- with the list of splices bound. There is no pure variant of this function
+-- because the desired behavior can only be achieved as a function of a
+-- Promise.
manyWithSplices :: Monad n
=> Splice n
+ -- ^ Splice to run for each of the items in the runtime list.
+ -- You'll frequently use 'runChildren' here.
-> [(Text, Promise a -> Splice n)]
+ -- ^ List of splices to bind
-> n [a]
+ -- ^ Runtime action returning a list of items to render.
-> Splice n
manyWithSplices splice splices runtimeAction = do
p <- newEmptyPromise
@@ -770,16 +779,3 @@ withPureSplices splice splices action = do
withLocalSplices splices' [] splice
-manyWithPureSplices :: Monad n
- => Splice n
- -> [(Text, a -> Builder)]
- -> n [a]
- -> Splice n
-manyWithPureSplices splice splices action = do
- let fieldSplice g = return $ yieldRuntime $ do
- items <- lift action
- res <- forM items $ return . g
- return $ mconcat res
- let splices' = map (second fieldSplice) splices
- withLocalSplices splices' [] splice
-
Please sign in to comment.
Something went wrong with that request. Please try again.