jyp / MarXup

Markup language on top of Haskell
GNU General Public License v2.0
11 stars 3 forks source link

Examples broken? #7

Open patrikja opened 1 year ago

patrikja commented 1 year ago

I tried to follow the README instructions:

cabal install
cd examples
ghc --make LaTeX

but the last command complained: ghc: could not execute: dist/build/marxup/marxup After fixing the path to marxup I got lots of import errors:

patrikj@dela:~/src/ext/MarXup/examples$ ghc --make LaTeX
[1 of 1] Compiling Main             ( LaTeX.hs, LaTeX.o )

LaTeX.hs:3:1: error:
    Could not find module ‘MarXup’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
3 | import MarXup
  | ^^^^^^^^^^^^^
...
LaTeX.hs:22:1: error:
    Could not find module ‘Data.GraphViz.Attributes.Complete’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
22 | import Data.GraphViz.Attributes.Complete
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

and even after adding a small cabal file with all(?) the dependencies I got a type error - probably due to the wrong version of one or more of the dependencies.

A minimal working example would be great!


For completeness, here is the cabal file

cabal-version:      2.4
name:               examples
version:            0.1.0.0
author:             JPB
maintainer:         just@testing
executable examples
    main-is: LaTeX.hs
    build-depends:    base ^>=4.16.4.0,
                      marxup,
                      lp-diagrams,
                      lens,
                      graphviz
    hs-source-dirs:   .
    default-language: Haskell2010

and the type error where I gave up

patrikj@dela:~/src/ext/MarXup/examples$ cabal build
Resolving dependencies...
Build profile: -w ghc-9.2.5 -O1
In order, the following will be built (use -v for more details):
 - examples-0.1.0.0 (exe:examples) (configuration changed)
Configuring executable 'examples' for examples-0.1.0.0..
Preprocessing executable 'examples' for examples-0.1.0.0..
Building executable 'examples' for examples-0.1.0.0..
[1 of 1] Compiling Main             ( LaTeX.hs, /home/patrikj/src/ext/MarXup/examples/dist-newstyle/build/x86_64-linux/ghc-9.2.5/examples-0.1.0.0/x/examples/build/examples/examples-tmp/Main.o )

LaTeX.hs:33:5: error:
    • Couldn't match type: (Object, b0)
                     with: (Box, Box, Vec2 (Transform Constant))
      Expected: PlotCanvas Constant
        Actual: (Object, b0)
    • In the pattern: (bx, _)
      In a stmt of a 'do' block:
        c@(bx, _) <- simplePlot
                       (Point
                          (textualS . showFFloat (Just 1)) (textualS . showEFloat (Just 0)))
                       (vec (simplLinAxis 0.1, logAxis 10))
                       (map vec [(0.1, 139), (0.35, 10035), (0.23, 1202)])
      In the expression:
        do c@(bx, _) <- simplePlot
                          (Point
                             (textualS . showFFloat (Just 1)) (textualS . showEFloat (Just 0)))
                          (vec (simplLinAxis 0.1, logAxis 10))
                          (map vec [(0.1, 139), (0.35, 10035), ....])
           functionPlot c 100 (\ x -> 100 + 300000 * (x - 0.2) ^^ 2)
           width bx === constant 200
           height bx === constant 100
   |
33 |   c@(bx,_) <- simplePlot (Point (textualS . showFFloat (Just 1)) (textualS . showEFloat (Just 0)))
   |     ^^^^^^