[Haskell-beginners] cabal.config (sandbox) with Chart package

Imants Cekusins imantc at gmail.com
Fri Aug 24 19:29:52 UTC 2018


Hi Jack,

cd to the root directory of your project and
> cabal init

This will walk you through the usual fields and create .cabal file for you.

You can also look up any package on hackage and peek into its .cabal file

;)



On 24 August 2018 at 22:22, Jack Vice <jack.vice at gmail.com> wrote:

> I am attempting my first sandbox build with a cabal package (Chart) and I
> don't know what to put in my cabal.config file after looking at these sites:
> https://www.haskell.org/cabal/users-guide/developing-packages.html
> http://coldwa.st/e/blog/2013-08-20-Cabal-sandbox.html
> https://wiki.haskell.org/Cabal-Install
>
> I am getting the following build error:
> *Building chartHask-0.1.0.0...*
> *Preprocessing executable 'chartHask' for chartHask-0.1.0.0...*
> *[1 of 1] Compiling Main             ( Main.hs,
> dist/build/chartHask/chartHask-tmp/Main.o )*
>
> *Main.hs:5:1: error:*
> *    Failed to load interface for ‘Graphics.Rendering.Chart.Backend.Cairo’*
> *    Perhaps you meant*
> *      Graphics.Rendering.Chart.Backend.Impl (from Chart-1.9)*
> *      Graphics.Rendering.Chart.Backend.Types (from Chart-1.9)*
> *      Graphics.Rendering.Chart.Backend (from Chart-1.9)*
> *    Use -v to see a list of the files searched for.*
>
> So, Maybe I'm dumb or it's not explicit (or both) on how to add a package
> to my cabal.config so it can find it and build.  I tried adding this to my
> cabal.config to no avail:
> *documentation: True*
> *constraints: Chart >= 1.9*
>
> Main.hs (from Chart example:
> *module Main where*
>
> *import Graphics.Rendering.Chart.Easy*
> *import Graphics.Rendering.Chart.Backend.Cairo*
>
> *signal :: [Double] -> [(Double,Double)]*
> *signal xs = [ (x,(sin (x*3.14159/45) + 1) / 2 * (sin (x*3.14159/5))) | x
> <- xs ]*
>
> *main = toFile def "example1_big.png" $ do*
> *    layout_title .= "Amplitude Modulation"*
> *    setColors [opaque blue, opaque red]*
> *    plot (line "am" [signal [0,(0.5)..400]])*
> *    plot (points "am points" (signal [0,7..400]))*
>
> Or should I be using Stack? (probably private email or new thread question)
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20180824/6cd73ff6/attachment-0001.html>


More information about the Beginners mailing list