summaryrefslogtreecommitdiff
path: root/src/Hakyll/Alias.hs
diff options
context:
space:
mode:
authorChris Wells <chris@mathematicaster.org>2026-01-20 17:00:40 -0600
committerChris Wells <chris@mathematicaster.org>2026-01-20 17:00:40 -0600
commit5d83e36ef8210d1514259c89ff97a25c4d19600c (patch)
treebb15b5d2f15e671b6963b1088a501e0dee758f2e /src/Hakyll/Alias.hs
parent8424579b0c79038510c3e763b1154cb6aea5cdfe (diff)
downloadmain-5d83e36ef8210d1514259c89ff97a25c4d19600c.tar
main-5d83e36ef8210d1514259c89ff97a25c4d19600c.tar.gz
main-5d83e36ef8210d1514259c89ff97a25c4d19600c.tar.bz2
main-5d83e36ef8210d1514259c89ff97a25c4d19600c.tar.lz
main-5d83e36ef8210d1514259c89ff97a25c4d19600c.tar.xz
main-5d83e36ef8210d1514259c89ff97a25c4d19600c.tar.zst
main-5d83e36ef8210d1514259c89ff97a25c4d19600c.zip
Technically working, but I need a cleaner way to pass personA and
journalA into a list context...
Diffstat (limited to 'src/Hakyll/Alias.hs')
-rw-r--r--src/Hakyll/Alias.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Hakyll/Alias.hs b/src/Hakyll/Alias.hs
index 33ed5c1..73beb86 100644
--- a/src/Hakyll/Alias.hs
+++ b/src/Hakyll/Alias.hs
@@ -20,7 +20,7 @@ import Hakyll.Web.Template.Util (functionField1)
aliasCtxt :: (Ord a, FromAlias a x) => String -> (String -> Compiler a) -> (x -> Compiler String) -> AliasMap a x -> Context c
aliasCtxt name toa fromx amap = functionField1 name $ toa >=> flip resolveAlias amap >=> fromx
-aliasCtxtFrom :: (Ord a, FromAlias a x) => String -> (String -> Compiler a) -> (x -> Compiler String) -> Identifier -> Context c
+aliasCtxtFrom :: forall a x c . (Binary a, Binary x, Typeable a, Typeable x, Ord a, FromAlias a x) => String -> (String -> Compiler a) -> (x -> Compiler String) -> Identifier -> Context c
aliasCtxtFrom name toa fromx ident = functionField1 name $ \s -> do
amap <- loadBody ident
toa s >>= flip resolveAlias amap >>= fromx
@@ -28,15 +28,15 @@ aliasCtxtFrom name toa fromx ident = functionField1 name $ \s -> do
-- personCtxt :: (StringConv StrictText s, Ord (Name s), ToMarkup s) => AliasMap (Name s) (Person s) -> Context a
personCtxt :: Identifier -> Context a
-personCtxt = aliasCtxtFrom @StrictText "personA" (ffmap toSL . parseName . toSL) (pure . toSL . personHtml)
+personCtxt = aliasCtxtFrom @Name_ @Person_ "personA" (parseName . toSL) (pure . toSL . personHtml)
-- personCtxtFrom :: Identifier -> Context a
-- personCtxtFrom = functionField1
-- licenseCtxt :: (StringConv String s, Ord s, ToMarkup s) => AliasMap s (License s) -> Context a
licenseCtxt :: Identifier -> Context a
-licenseCtxt = aliasCtxtFrom @StrictText "licenseA" (pure . toSL) (pure . toSL . licenseHtml)
+licenseCtxt = aliasCtxtFrom @StrictText @License_ "licenseA" (pure . toSL) (pure . toSL . licenseHtml)
-- journalCtxt :: (StringConv String s, Ord s, ToMarkup s) => AliasMap s (Journal s) -> Context a
journalCtxt :: Identifier -> Context a
-journalCtxt = aliasCtxtFrom @StrictText "journalA" (pure . toSL) (pure . toSL . journalHtml)
+journalCtxt = aliasCtxtFrom @StrictText @Journal_ "journalA" (pure . toSL) (pure . toSL . journalHtml)