Discussion:
setVersion and a Pattern
Paul Haerle
2014-04-02 23:43:07 UTC
Permalink
Hi,

I had the following code
tagsRules galleries' $ \name pattern -> do
route idRoute
compile $ do
photos' <- loadAll $ pattern .&&. hasVersion "thumb"
Which obviously did not work because the documentation of "FromList" says "
*Warning*: use this carefully with
hasNoVersion<http://jaspervdj.be/hakyll/reference/Hakyll-Core-Identifier-Pattern.html#v:hasNoVersion>and
hasVersion<http://jaspervdj.be/hakyll/reference/Hakyll-Core-Identifier-Pattern.html#v:hasVersion>.
The Identifier<http://jaspervdj.be/hakyll/reference/Hakyll-Core-Identifier.html#t:Identifier>s
in the list *already* have versions assigned, and the pattern will then
only match the intersection of both versions." and recommends to use
fromList $ map (setVersion $ Just "pdf") ["foo.markdown"]
Instead. My problem is that, tagRules already calls FromList and gives me a
pattern instead of a list of identifiers. So my rather hackish solution was
to copy the source of tagRules to tagRules' and remove fromList in the last
line. Now
tagsRules' galleries' $ \name identifiers -> do
route idRoute
compile $ do
photos' <- loadAll $ fromList $ map (setVersion $ Just "thumb")
identifiers

Seems to work fine, but I wonder if there is a cleaner solution which I am
overlooking?

thanks
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Loading...