aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2025-04-07 10:47:51 -0700
committerPaul Oliver <contact@pauloliver.dev>2025-04-07 10:47:51 -0700
commite82648073a19f96d8344d0120a03184ae510e1f4 (patch)
tree0963a18e9a52b1701e9e850180d83548c3d595be
parentc8992bc7543d8ca7c2ee3cc200a7fbf1a5fae059 (diff)
Improves haskell
-rw-r--r--.gitignore2
-rw-r--r--portfolio-hs.cabal19
-rw-r--r--site.hs49
-rw-r--r--stack.yaml1
-rw-r--r--stack.yaml.lock12
5 files changed, 44 insertions, 39 deletions
diff --git a/.gitignore b/.gitignore
index 4497c7b..5731bbf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,3 @@
+.stack-work/
_cache/
_site/
-dist-newstyle/
diff --git a/portfolio-hs.cabal b/portfolio-hs.cabal
index 2fa6a0b..8140229 100644
--- a/portfolio-hs.cabal
+++ b/portfolio-hs.cabal
@@ -1,17 +1,14 @@
cabal-version: 3.4
-
-name: portfolio-hs
-version: 0.1.0.0
-build-type: Simple
+name: portfolio-hs
+version: 0.1.0.0
+build-type: Simple
executable site
- main-is: site.hs
build-depends:
- base
+ , base
, hakyll
, pandoc
- ghc-options:
- -rtsopts
- -threaded
- -with-rtsopts=-N
- default-language: Haskell2010
+
+ main-is: site.hs
+ ghc-options: -Wall -Wextra
+ default-language: GHC2021
diff --git a/site.hs b/site.hs
index a02e75d..76e6f50 100644
--- a/site.hs
+++ b/site.hs
@@ -1,32 +1,27 @@
{-# LANGUAGE OverloadedStrings #-}
-import Hakyll
- ( Configuration(..)
- , compile
- , compressCssCompiler
- , defaultConfiguration
- , defaultContext
- , hakyllWith
- , idRoute
- , loadAndApplyTemplate
- , match
- , pandocCompiler
- , relativizeUrls
- , route
- , setExtension
- , templateBodyCompiler
- )
+import Hakyll qualified as H
-config :: Configuration
-config = defaultConfiguration {deployCommand = "rsync -rv _site/ debnode:portfolio"}
+pandoc :: H.Compiler (H.Item String)
+pandoc =
+ H.pandocCompiler
+ >>= H.loadAndApplyTemplate "templates/default.html" H.defaultContext
+ >>= H.relativizeUrls
+
+index :: H.Rules ()
+index =
+ H.match "index.md" $ do
+ H.route $ H.setExtension "html"
+ H.compile pandoc
+
+css :: H.Rules ()
+css =
+ H.match "css/*" $ do
+ H.route H.idRoute
+ H.compile H.compressCssCompiler
+
+template :: H.Rules ()
+template = H.match "templates/*" $ H.compile H.templateBodyCompiler
main :: IO ()
-main =
- hakyllWith config $ do
- match "index.md" $ do
- route $ setExtension "html"
- compile $ pandocCompiler >>= loadAndApplyTemplate "templates/default.html" defaultContext >>= relativizeUrls
- match "css/*" $ do
- route idRoute
- compile compressCssCompiler
- match "templates/*" $ compile templateBodyCompiler
+main = H.hakyllWith H.defaultConfiguration $ index >> css >> template
diff --git a/stack.yaml b/stack.yaml
new file mode 100644
index 0000000..722717e
--- /dev/null
+++ b/stack.yaml
@@ -0,0 +1 @@
+snapshot: lts-23.18
diff --git a/stack.yaml.lock b/stack.yaml.lock
new file mode 100644
index 0000000..893c60a
--- /dev/null
+++ b/stack.yaml.lock
@@ -0,0 +1,12 @@
+# This file was autogenerated by Stack.
+# You should not edit this file by hand.
+# For more information, please see the documentation at:
+# https://docs.haskellstack.org/en/stable/topics/lock_files
+
+packages: []
+snapshots:
+- completed:
+ sha256: d133abe75e408a407cce3f032c96ac1bbadf474a93b5156ebf4135b53382d56b
+ size: 683827
+ url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/23/18.yaml
+ original: lts-23.18