diagrams / diagrams-pandoc

A pandoc filter to express diagrams inline using the haskell EDSL diagrams.
BSD 3-Clause "New" or "Revised" License
37 stars 9 forks source link

Test fails on diagrams-1.4 #15

Open Wojocom opened 7 years ago

Wojocom commented 7 years ago

pandoc -t html demo.md --filter diagrams-pandoc -o demo.html -s

gives following error message:

Error while interpreting

example = square 1
<interactive>:2:1:
    Couldn't match expected type ‘V2’
                with actual type ‘V (IO (QDiagram Cairo V2 Double Any))’
    In the expression: example
    In an equation for ‘e_1’: e_1 = example
    In the expression:
        (let e_1 = example in e_1) :: IO (QDiagram Cairo V2 Double Any)

with demo.md containing:

Here is a square :
''' {.diagram}
example = square 1
'''

Use following package versions:

byorgey commented 7 years ago

Hmm. Does it work if you add a type annotation, like

Here is a square :
''' {.diagram}
example = square 1 :: Diagram B
'''

?

Wojocom commented 7 years ago

When I try type annotation I get this

Error while interpreting
example = square 1 :: Diagram B
/tmp/Diagram1804289383846930886.hs:11:11:
    Couldn't match type ‘V B’ with ‘V2’
    In the expression: square 1 :: Diagram B
    In an equation for ‘example’: example = square 1 :: Diagram B

Thank you for the quick response. Is there a way to have a look into /tmp/Diagram1804289383846930886.hs. It seems to get deleted.

BTW, compiling the following with GHC works:

{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE FlexibleContexts          #-}
{-# LANGUAGE TypeFamilies              #-}

import Diagrams.Prelude
import Diagrams.Backend.SVG.CmdLine

example = square 1 :: Diagram B

main = mainWith example
byorgey commented 7 years ago

Hmm, can you try instead doing

example = square 1 :: QDiagram Cairo V2 Double Any

?