cdosborn
cdosborn

Reputation: 3469

Type alias not recognized using cheapskate in haskell

Summary:

I'm using Cheapskate a library created by John MacFarlane, author of Pandoc, for markdown parsing. I'm running into a type issue that I cannot resolve. Basically I'm trying to generate the html for a code block. I ultimately want renderBlocks def blocks to type check. I cannot get blocks to be of type Blocks

In the source code, the type Blocks is aliased to Seq Block yet my error message says they are different. I've tried laying excessive type annotation throughout without luck. If I specify the type is Blocks as opposed to Seq Block I get an error specifying Blocks as Seq a0.

Here is my project for reference.

The 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

The 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

Upvotes: 3

Views: 100

Answers (1)

cdosborn
cdosborn

Reputation: 3469

Solution was to revert to older containers package from (0.5.5.1) to (0.4.2.1).

Upvotes: 1

Related Questions