summaryrefslogtreecommitdiff
path: root/src/Hakyll/Web
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-05-24 11:58:13 +0200
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-05-24 11:58:13 +0200
commit758e0beaaa2f9f97bb22fa4067d75efda4dbd31b (patch)
tree5f783f2652628f2d3c70a2e868e79145ff469a32 /src/Hakyll/Web
parent41b7f3713889e8c5b4a21a85d8a2fcebf0b59054 (diff)
downloadhakyll-758e0beaaa2f9f97bb22fa4067d75efda4dbd31b.tar.gz
Type-safe identifiers
Diffstat (limited to 'src/Hakyll/Web')
-rw-r--r--src/Hakyll/Web/Pandoc.hs18
-rw-r--r--src/Hakyll/Web/Tags.hs12
-rw-r--r--src/Hakyll/Web/Template.hs2
3 files changed, 16 insertions, 16 deletions
diff --git a/src/Hakyll/Web/Pandoc.hs b/src/Hakyll/Web/Pandoc.hs
index d107702..a1bd09c 100644
--- a/src/Hakyll/Web/Pandoc.hs
+++ b/src/Hakyll/Web/Pandoc.hs
@@ -33,19 +33,19 @@ import Hakyll.Web.Page.Internal
-- | Read a string using pandoc, with the default options
--
-readPandoc :: FileType -- ^ File type, determines how parsing happens
- -> Maybe Identifier -- ^ Optional, for better error messages
- -> String -- ^ String to read
- -> Pandoc -- ^ Resulting document
+readPandoc :: FileType -- ^ Determines how parsing happens
+ -> Maybe (Identifier a) -- ^ Optional, for better error messages
+ -> String -- ^ String to read
+ -> Pandoc -- ^ Resulting document
readPandoc = readPandocWith defaultHakyllParserState
-- | Read a string using pandoc, with the supplied options
--
-readPandocWith :: ParserState -- ^ Parser options
- -> FileType -- ^ File type, determines parsing method
- -> Maybe Identifier -- ^ Optional, for better error messages
- -> String -- ^ String to read
- -> Pandoc -- ^ Resulting document
+readPandocWith :: ParserState -- ^ Parser options
+ -> FileType -- ^ Determines parsing method
+ -> Maybe (Identifier a) -- ^ Optional, for better error messages
+ -> String -- ^ String to read
+ -> Pandoc -- ^ Resulting document
readPandocWith state fileType' id' = case fileType' of
Html -> readHtml state
LaTeX -> readLaTeX state
diff --git a/src/Hakyll/Web/Tags.hs b/src/Hakyll/Web/Tags.hs
index 32076a0..d05256e 100644
--- a/src/Hakyll/Web/Tags.hs
+++ b/src/Hakyll/Web/Tags.hs
@@ -111,7 +111,7 @@ readCategory = readTagsWith getCategory
-- | Render tags in HTML
--
-renderTags :: (String -> Identifier)
+renderTags :: (String -> Identifier a)
-- ^ Produce a link
-> (String -> String -> Int -> Int -> Int -> String)
-- ^ Produce a tag item: tag, url, count, min count, max count
@@ -141,7 +141,7 @@ renderTags makeUrl makeItem concatItems = proc (Tags tags) -> do
-- | Render a tag cloud in HTML
--
-renderTagCloud :: (String -> Identifier) -- ^ Produce a link for a tag
+renderTagCloud :: (String -> Identifier a) -- ^ Produce a link for a tag
-> Double -- ^ Smallest font size, in percent
-> Double -- ^ Biggest font size, in percent
-> Compiler (Tags a) String -- ^ Tag cloud renderer
@@ -162,7 +162,7 @@ renderTagCloud makeUrl minSize maxSize =
-- | Render a simple tag list in HTML, with the tag count next to the item
--
-renderTagList :: (String -> Identifier) -> Compiler (Tags a) (String)
+renderTagList :: (String -> Identifier a) -> Compiler (Tags a) (String)
renderTagList makeUrl = renderTags makeUrl makeLink (intercalate ", ")
where
makeLink tag url count _ _ = renderHtml $
@@ -172,7 +172,7 @@ renderTagList makeUrl = renderTags makeUrl makeLink (intercalate ", ")
--
renderTagsFieldWith :: (Page a -> [String]) -- ^ Function to get the tags
-> String -- ^ Destination key
- -> (String -> Identifier) -- ^ Create a link for a tag
+ -> (String -> Identifier a) -- ^ Create a link for a tag
-> Compiler (Page a) (Page a) -- ^ Resulting compiler
renderTagsFieldWith tags destination makeUrl =
id &&& arr tags >>> setFieldA destination renderTags'
@@ -192,13 +192,13 @@ renderTagsFieldWith tags destination makeUrl =
-- | Render tags with links
--
renderTagsField :: String -- ^ Destination key
- -> (String -> Identifier) -- ^ Create a link for a tag
+ -> (String -> Identifier a) -- ^ Create a link for a tag
-> Compiler (Page a) (Page a) -- ^ Resulting compiler
renderTagsField = renderTagsFieldWith getTags
-- | Render the category in a link
--
renderCategoryField :: String -- ^ Destination key
- -> (String -> Identifier) -- ^ Create a category link
+ -> (String -> Identifier a) -- ^ Create a category link
-> Compiler (Page a) (Page a) -- ^ Resulting compiler
renderCategoryField = renderTagsFieldWith getCategory
diff --git a/src/Hakyll/Web/Template.hs b/src/Hakyll/Web/Template.hs
index 33e7a9b..222ab23 100644
--- a/src/Hakyll/Web/Template.hs
+++ b/src/Hakyll/Web/Template.hs
@@ -104,6 +104,6 @@ templateCompilerWith settings =
-- Hakyll template
else readTemplate string
-applyTemplateCompiler :: Identifier -- ^ Template
+applyTemplateCompiler :: Identifier Template -- ^ Template
-> Compiler (Page String) (Page String) -- ^ Compiler
applyTemplateCompiler identifier = require identifier (flip applyTemplate)