d***@gmail.com
2016-03-29 18:37:39 UTC
I don't understand why the drastic changes, but now my stuff doesn't
compile after stupidly updating cabal, I now have the newest version of
Hakyll, built a quick site to make sure everything works but my old stuff
isn't running.
[1 of 1] Compiling Main ( bin/site.hs, bin/site.o )
bin/site.hs:31:12: Not in scope: âpredicateâ
bin/site.hs:58:12: Not in scope: âpredicateâ
bin/site.hs:66:27:
Not in scope: âconstAâ
Perhaps you meant âconstâ (imported from Prelude)
bin/site.hs:67:18: Not in scope: âsetFieldâ
bin/site.hs:68:13: Not in scope: ârequireAllAâ
bin/site.hs:69:13: Not in scope: ârequireAllAâ
bin/site.hs:74:36:
Not in scope: âconstAâ
Perhaps you meant âconstâ (imported from Prelude)
bin/site.hs:75:18: Not in scope: âsetFieldâ
bin/site.hs:76:13: Not in scope: ârequireAllAâ
bin/site.hs:81:38:
Not in scope: âconstAâ
Perhaps you meant âconstâ (imported from Prelude)
bin/site.hs:82:18: Not in scope: âsetFieldâ
bin/site.hs:83:13: Not in scope: ârequireAllAâ
bin/site.hs:91:9: Not in scope: ârequireAll_â
bin/site.hs:108:18:
Not in scope: type constructor or class âResourceâ
bin/site.hs:115:30:
Not in scope: type constructor or class âResourceâ
bin/site.hs:115:40: Not in scope: type constructor or class âPageâ
bin/site.hs:117:29:
Not in scope: âreadPageâ
Perhaps you meant âreadParenâ (imported from Prelude)
bin/site.hs:118:25: Not in scope: âaddDefaultFieldsâ
bin/site.hs:121:25: Not in scope: âpageRenderPandocâ
bin/site.hs:124:30:
Not in scope: type constructor or class âResourceâ
bin/site.hs:124:40: Not in scope: type constructor or class âPageâ
bin/site.hs:127:29:
Not in scope: âreadPageâ
Perhaps you meant âreadParenâ (imported from Prelude)
bin/site.hs:128:25: Not in scope: âaddDefaultFieldsâ
bin/site.hs:131:25: Not in scope: âpageRenderPandocâ
bin/site.hs:155:14: Not in scope: type constructor or class âPageâ
bin/site.hs:155:26: Not in scope: type constructor or class âPageâ
bin/site.hs:156:32: Not in scope: âsortByBaseNameâ
bin/site.hs:159:18: Not in scope: âchangeFieldâ
bin/site.hs:162:14:
Not in scope: ârenderFieldâ
Perhaps you meant âteaserFieldâ (imported from Hakyll)
bin/site.hs:164:23: Not in scope: type constructor or class âPageâ
bin/site.hs:164:37: Not in scope: type constructor or class âPageâ
bin/site.hs:164:52: Not in scope: type constructor or class âPageâ
bin/site.hs:167:26: Not in scope: type constructor or class âPageâ
bin/site.hs:167:40: Not in scope: type constructor or class âPageâ
bin/site.hs:167:55: Not in scope: type constructor or class âPageâ
bin/site.hs:170:48: Not in scope: type constructor or class âPageâ
bin/site.hs:170:62: Not in scope: type constructor or class âPageâ
bin/site.hs:170:77: Not in scope: type constructor or class âPageâ
bin/site.hs:171:28: Not in scope: âsetFieldAâ
bin/site.hs:172:20: Not in scope: âsortByBaseNameâ
bin/site.hs:174:13: Not in scope: ârequireâ
bin/site.hs:176:17: Not in scope: âpageBodyâ
Can someone help me get this to work? I'm not really a haskell guy, total
newb.
Here is my site.hs:
{-# LANGUAGE OverloadedStrings, Arrows #-}
module Main where
import Prelude hiding (id)
import Control.Category (id)
import Control.Arrow ((>>>), (>>^), (***), arr)
import Control.Monad (forM_)
import Data.Monoid (mempty, mconcat)
import System.FilePath
import Hakyll
main :: IO ()
main = hakyll $ do
-----------------------------------------------------------------------
-- compile templates
-----------------------------------------------------------------------
match "templates/*" $ compile templateCompiler
-----------------------------------------------------------------------
-- copy resources files & process css as necessary
-----------------------------------------------------------------------
match "resources/css/**" $ do
route $ setRoot `composeRoutes` setExtension "css"
compile sass
-- compile $ byExtension (error "not a valid css file")
-- [ (".css", sass)
-- , (".scss", sass) ]
match (predicate (\i -> matches "resources/**" i && not (matches
"resources/css/**" i))) $ do
route setRoot
compile copyFileCompiler
-- create site pages
-----------------------------------------------------------------------
forM_ indexPages $ \p -> match p $ do
route $ setRoot `composeRoutes` toIndex
compile $ unGitHubCompiler
route $ setRoot `composeRoutes` cleanURL
compile $ unGitHubCompiler
route setRoot
compile defaultCompiler
match "p*/***.html" $ do
route $ setRoot `composeRoutes` cleanURL
compile defaultCompiler
match (predicate (\i -> matches "p*/**" i && not (matches "*.m*d" i)))
$ do
route $ setRoot `composeRoutes` idRoute
compile copyFileCompiler
-- special root pages
-----------------------------------------------------------------------
match "index.html" $ route idRoute
create "index.html" $ constA mempty
create "./posts/index.html" $ constA mempty
create "./projects/index.html" $ constA mempty
-----------------------------------------------------------------------
match "atom.xml" $ route idRoute
create "atom.xml" $
requireAll_ "projects/*/*.md" >>= renderAtom feedConfiguration
where
indexPages = [ "p*/**README.*"
, "p*/**index.*" ]
markdownPages = [ "p*/***.md"
, "p*/***.mkd"
, "p*/***.mkdn"
, "p*/***.mdown"
, "p*/***.markdown"
, "p*/***.pandoc"
, "p*/***.pdc"
, "p*/***.lhs" ]
-----------------------------------------------------------------------
-- custom compilers
-----------------------------------------------------------------------
sass :: Compiler Resource String
sass = getResourceString >>= unixFilter "sass" ["-s", "--scss"]
unGitHub = unixFilter "sed"
["s+https://github.com/[^/]*/\\([^:/]*\\)/raw/master+/\\1+g"]
defaultCompiler :: Compiler Resource (Page String)
defaultCompiler = getResourceString
unGitHubCompiler = getResourceString
-----------------------------------------------------------------------
setRoot :: Routes
setRoot = customRoute stripTopDir
stripTopDir :: Identifier -> FilePath
stripTopDir = joinPath . tail . splitPath . toFilePath
cleanURL :: Routes
cleanURL = customRoute fileToDirectory
fileToDirectory :: Identifier -> FilePath
fileToDirectory = (flip combine) "index.html" . dropExtension . toFilePath
toIndex :: Routes
toIndex = customRoute fileToIndex
fileToIndex :: Identifier -> FilePath
fileToIndex = (flip combine) "index.html" . dropFileName . toFilePath
-- misc functions
-----------------------------------------------------------------------
newest10 :: [Page a] -> [Page a]
newest10 = take 10 . reverse . sortByBaseName
stripIndexLink :: Item a -> Item a
stripIndexLink = changeField "url" dropFileName
buildTitle :: Item a -> Item a
buildTitle = renderField "title" "pagetitle" (++ " - Franklin De Los
Santos")
postList :: Compiler (Page String, [Page String]) (Page String)
postList = buildList "postlist" "templates/item.html"
projectList :: Compiler (Page String, [Page String]) (Page String)
projectList = buildList "projectlist" "templates/item.html"
buildList :: String -> Identifier -> Compiler (Page String, [Page String])
(Page String)
buildList field template = setFieldA field $
arr (reverse . sortByBaseName)
-----------------------------------------------------------------------
feedConfiguration :: FeedConfiguration
feedConfiguration = FeedConfiguration
{ feedTitle = "fadelosa.com"
, feedDescription = "Projects & Posts from Franklin De Los Santos"
, feedAuthorName = "Franklin De Los Santos"
, feedRoot = "http://fadelosa.com"
}
I made some small changes, but I've been at this all night.
compile after stupidly updating cabal, I now have the newest version of
Hakyll, built a quick site to make sure everything works but my old stuff
isn't running.
[1 of 1] Compiling Main ( bin/site.hs, bin/site.o )
bin/site.hs:31:12: Not in scope: âpredicateâ
bin/site.hs:58:12: Not in scope: âpredicateâ
bin/site.hs:66:27:
Not in scope: âconstAâ
Perhaps you meant âconstâ (imported from Prelude)
bin/site.hs:67:18: Not in scope: âsetFieldâ
bin/site.hs:68:13: Not in scope: ârequireAllAâ
bin/site.hs:69:13: Not in scope: ârequireAllAâ
bin/site.hs:74:36:
Not in scope: âconstAâ
Perhaps you meant âconstâ (imported from Prelude)
bin/site.hs:75:18: Not in scope: âsetFieldâ
bin/site.hs:76:13: Not in scope: ârequireAllAâ
bin/site.hs:81:38:
Not in scope: âconstAâ
Perhaps you meant âconstâ (imported from Prelude)
bin/site.hs:82:18: Not in scope: âsetFieldâ
bin/site.hs:83:13: Not in scope: ârequireAllAâ
bin/site.hs:91:9: Not in scope: ârequireAll_â
bin/site.hs:108:18:
Not in scope: type constructor or class âResourceâ
bin/site.hs:115:30:
Not in scope: type constructor or class âResourceâ
bin/site.hs:115:40: Not in scope: type constructor or class âPageâ
bin/site.hs:117:29:
Not in scope: âreadPageâ
Perhaps you meant âreadParenâ (imported from Prelude)
bin/site.hs:118:25: Not in scope: âaddDefaultFieldsâ
bin/site.hs:121:25: Not in scope: âpageRenderPandocâ
bin/site.hs:124:30:
Not in scope: type constructor or class âResourceâ
bin/site.hs:124:40: Not in scope: type constructor or class âPageâ
bin/site.hs:127:29:
Not in scope: âreadPageâ
Perhaps you meant âreadParenâ (imported from Prelude)
bin/site.hs:128:25: Not in scope: âaddDefaultFieldsâ
bin/site.hs:131:25: Not in scope: âpageRenderPandocâ
bin/site.hs:155:14: Not in scope: type constructor or class âPageâ
bin/site.hs:155:26: Not in scope: type constructor or class âPageâ
bin/site.hs:156:32: Not in scope: âsortByBaseNameâ
bin/site.hs:159:18: Not in scope: âchangeFieldâ
bin/site.hs:162:14:
Not in scope: ârenderFieldâ
Perhaps you meant âteaserFieldâ (imported from Hakyll)
bin/site.hs:164:23: Not in scope: type constructor or class âPageâ
bin/site.hs:164:37: Not in scope: type constructor or class âPageâ
bin/site.hs:164:52: Not in scope: type constructor or class âPageâ
bin/site.hs:167:26: Not in scope: type constructor or class âPageâ
bin/site.hs:167:40: Not in scope: type constructor or class âPageâ
bin/site.hs:167:55: Not in scope: type constructor or class âPageâ
bin/site.hs:170:48: Not in scope: type constructor or class âPageâ
bin/site.hs:170:62: Not in scope: type constructor or class âPageâ
bin/site.hs:170:77: Not in scope: type constructor or class âPageâ
bin/site.hs:171:28: Not in scope: âsetFieldAâ
bin/site.hs:172:20: Not in scope: âsortByBaseNameâ
bin/site.hs:174:13: Not in scope: ârequireâ
bin/site.hs:176:17: Not in scope: âpageBodyâ
Can someone help me get this to work? I'm not really a haskell guy, total
newb.
Here is my site.hs:
{-# LANGUAGE OverloadedStrings, Arrows #-}
module Main where
import Prelude hiding (id)
import Control.Category (id)
import Control.Arrow ((>>>), (>>^), (***), arr)
import Control.Monad (forM_)
import Data.Monoid (mempty, mconcat)
import System.FilePath
import Hakyll
main :: IO ()
main = hakyll $ do
-----------------------------------------------------------------------
-- compile templates
-----------------------------------------------------------------------
match "templates/*" $ compile templateCompiler
-----------------------------------------------------------------------
-- copy resources files & process css as necessary
-----------------------------------------------------------------------
match "resources/css/**" $ do
route $ setRoot `composeRoutes` setExtension "css"
compile sass
-- compile $ byExtension (error "not a valid css file")
-- [ (".css", sass)
-- , (".scss", sass) ]
match (predicate (\i -> matches "resources/**" i && not (matches
"resources/css/**" i))) $ do
route setRoot
compile copyFileCompiler
-- create site pages
-----------------------------------------------------------------------
forM_ indexPages $ \p -> match p $ do
route $ setRoot `composeRoutes` toIndex
compile $ unGitHubCompiler
= loadAndApplyTemplate "templates/page.html"
= loadAndApplyTemplate "templates/default.html"
forM_ markdownPages $ \p -> match p $ do= loadAndApplyTemplate "templates/default.html"
route $ setRoot `composeRoutes` cleanURL
compile $ unGitHubCompiler
= loadAndApplyTemplate "templates/page.html"
= loadAndApplyTemplate "templates/default.html"
match "p*/**/index.html" $ do= loadAndApplyTemplate "templates/default.html"
route setRoot
compile defaultCompiler
match "p*/***.html" $ do
route $ setRoot `composeRoutes` cleanURL
compile defaultCompiler
match (predicate (\i -> matches "p*/**" i && not (matches "*.m*d" i)))
$ do
route $ setRoot `composeRoutes` idRoute
compile copyFileCompiler
-- special root pages
-----------------------------------------------------------------------
match "index.html" $ route idRoute
create "index.html" $ constA mempty
= arr (setField "pagetitle" "Franklin De Los Santos")
= requireAllA "posts/***.md" (id *** arr newest10 >>= postList)
= requireAllA "projects/*/*.md" projectList
= loadAndApplyTemplate "templates/home.html"
= loadAndApplyTemplate "templates/default.html"
match "./posts/index.html" $ route idRoute= requireAllA "posts/***.md" (id *** arr newest10 >>= postList)
= requireAllA "projects/*/*.md" projectList
= loadAndApplyTemplate "templates/home.html"
= loadAndApplyTemplate "templates/default.html"
create "./posts/index.html" $ constA mempty
= arr (setField "pagetitle" "Posts - Franklin De Los Santos")
= requireAllA "posts/***.md" postList
= loadAndApplyTemplate "templates/posts.html"
= loadAndApplyTemplate "templates/default.html"
match "./projects/index.html" $ route idRoute= requireAllA "posts/***.md" postList
= loadAndApplyTemplate "templates/posts.html"
= loadAndApplyTemplate "templates/default.html"
create "./projects/index.html" $ constA mempty
= arr (setField "pagetitle" "Projects - Franklin De Los Santos")
= requireAllA "projects/*/*.md" projectList
= loadAndApplyTemplate "templates/projects.html"
= loadAndApplyTemplate "templates/default.html"
-- render rss feed= requireAllA "projects/*/*.md" projectList
= loadAndApplyTemplate "templates/projects.html"
= loadAndApplyTemplate "templates/default.html"
-----------------------------------------------------------------------
match "atom.xml" $ route idRoute
create "atom.xml" $
requireAll_ "projects/*/*.md" >>= renderAtom feedConfiguration
where
indexPages = [ "p*/**README.*"
, "p*/**index.*" ]
markdownPages = [ "p*/***.md"
, "p*/***.mkd"
, "p*/***.mkdn"
, "p*/***.mdown"
, "p*/***.markdown"
, "p*/***.pandoc"
, "p*/***.pdc"
, "p*/***.lhs" ]
-----------------------------------------------------------------------
-- custom compilers
-----------------------------------------------------------------------
sass :: Compiler Resource String
sass = getResourceString >>= unixFilter "sass" ["-s", "--scss"]
= arr compressCss
unGitHub :: Compiler String StringunGitHub = unixFilter "sed"
["s+https://github.com/[^/]*/\\([^:/]*\\)/raw/master+/\\1+g"]
defaultCompiler :: Compiler Resource (Page String)
defaultCompiler = getResourceString
= arr readPage
= addDefaultFields
= arr applyAsTemplate
= arr buildTitle
= pageRenderPandoc
= loadAndApplyTemplate "templates/default.html"
unGitHubCompiler :: Compiler Resource (Page String)= addDefaultFields
= arr applyAsTemplate
= arr buildTitle
= pageRenderPandoc
= loadAndApplyTemplate "templates/default.html"
unGitHubCompiler = getResourceString
= unGitHub
= arr readPage
= addDefaultFields
= arr applyAsTemplate
= arr buildTitle
= pageRenderPandoc
-- custom routes= arr readPage
= addDefaultFields
= arr applyAsTemplate
= arr buildTitle
= pageRenderPandoc
-----------------------------------------------------------------------
setRoot :: Routes
setRoot = customRoute stripTopDir
stripTopDir :: Identifier -> FilePath
stripTopDir = joinPath . tail . splitPath . toFilePath
cleanURL :: Routes
cleanURL = customRoute fileToDirectory
fileToDirectory :: Identifier -> FilePath
fileToDirectory = (flip combine) "index.html" . dropExtension . toFilePath
toIndex :: Routes
toIndex = customRoute fileToIndex
fileToIndex :: Identifier -> FilePath
fileToIndex = (flip combine) "index.html" . dropFileName . toFilePath
-- misc functions
-----------------------------------------------------------------------
newest10 :: [Page a] -> [Page a]
newest10 = take 10 . reverse . sortByBaseName
stripIndexLink :: Item a -> Item a
stripIndexLink = changeField "url" dropFileName
buildTitle :: Item a -> Item a
buildTitle = renderField "title" "pagetitle" (++ " - Franklin De Los
Santos")
postList :: Compiler (Page String, [Page String]) (Page String)
postList = buildList "postlist" "templates/item.html"
projectList :: Compiler (Page String, [Page String]) (Page String)
projectList = buildList "projectlist" "templates/item.html"
buildList :: String -> Identifier -> Compiler (Page String, [Page String])
(Page String)
buildList field template = setFieldA field $
arr (reverse . sortByBaseName)
= arr (map stripIndexLink)
= require template (\p t -> map (applyTemplate t) p)
= arr mconcat
= arr pageBody
-- misc functions= require template (\p t -> map (applyTemplate t) p)
= arr mconcat
= arr pageBody
-----------------------------------------------------------------------
feedConfiguration :: FeedConfiguration
feedConfiguration = FeedConfiguration
{ feedTitle = "fadelosa.com"
, feedDescription = "Projects & Posts from Franklin De Los Santos"
, feedAuthorName = "Franklin De Los Santos"
, feedRoot = "http://fadelosa.com"
}
I made some small changes, but I've been at this all night.
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.