Alias type not recognized by cheapskate in haskell
Summary:
I am using the Cheapskate library created by John McFarlane, author of Pandoc, to parse the markup. I am facing a type problem that I cannot solve. Basically I am trying to generate html for a block of code. I ultimately want to renderBlocks def blocks
print a check. I cannot get blocks likeBlocks
In the original code, the type is Blocks
aliased to Seq Block
, but my error message says they are different. I have tried overlaying type annotation with no luck. If I specify the type Blocks
rather than Seq Block
, I get an error Blocks
like Seq a0
.
Here is my project for reference.
Error message:
Couldn't match expected type `Blocks' with actual type `Seq Block'
In the second argument of `renderBlocks', namely `blocks'
In the expression: renderBlocks Cheapskate.def blocks
In the expression:
let
t = T.concat $ map partToText parts
attr
= CodeAttr {codeLang = (T.pack "haskell"), codeInfo = T.empty} ::
CodeAttr
block = CodeBlock attr t
....
in renderBlocks Cheapskate.def blocks
Code:
chunkToHtml :: Chunk -> Markup
chunkToHtml chunk =
case chunk of
Prose str -> toMarkup $ markdown Cheapskate.def (T.pack str)
Def _ _ parts ->
let
t = T.concat $ map partToText parts
attr = CodeAttr { codeLang=(T.pack "haskell"), codeInfo=T.empty} :: CodeAttr
block = CodeBlock attr t
blocks = (singleton block) :: Seq Block
in
renderBlocks Cheapskate.def blocks
source to share