Expose SomeItem?
I guess I need data SomeItem to be exposed/exported, otherwise I seem can't use rulesCompilers from RuleSet:
rulesCompilers :: [(Identifier, Compiler SomeItem)]
SomeItem is not exposed, so I can't for example define types of functions, and GHC fails to match any of my code with Hakyll.Core.Item.SomeItem.SomeItem.
P. S. I think the actual problem is to recover original compiler (Compiler (Item a)) from Compiler SomeItem.
I'm happy with exposing this but maybe there's another way to get out what you want? What are you trying to do?
I am trying to "postprocess" the rules. That's I write the rules for a site in the normal way, than I want to extend the site by creating a translated site (with po4a). Something like this:
newRules ::
[String]
-> Routes
-> Provider
-> (Identifier, Compiler SomeItem)
-> IO (Rules ())
newRules langs routes provider (identifier, somecomp) = do
mrt <- fst <$> Routes.runRoutes routes provider identifier
return $
case mrt of
Nothing -> create [identifier] (compileSome somecomp)
Just rt ->
if needTranslation rt
then mapM_ mkPages langs
else create [identifier] $ do
route (constRoute rt)
compileSome somecomp
where mkPages lang = do
let rtt = mkLangRoute lang rt
rto = mkLangRoute origLang rt
orig = destinationDirectory config </> rto
if rtt == rto
then create [identifier] $ do
route (constRoute rtt)
compileSome somecomp
else create [identifier] $
rulesExtraDependencies
[ IdentifierDependency . fromFilePath . poFile $ lang
, IdentifierDependency . fromFilePath $ orig
] $
version lang $ do
route (constRoute rtt)
compile (translate orig lang)