From 5d83e36ef8210d1514259c89ff97a25c4d19600c Mon Sep 17 00:00:00 2001 From: Chris Wells Date: Tue, 20 Jan 2026 17:00:40 -0600 Subject: Technically working, but I need a cleaner way to pass personA and journalA into a list context... --- src/Hakyll/Alias.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Hakyll/Alias.hs') 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) -- cgit v1.2.3