cabal.config (sandbox) with Chart package

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

cabal.config (sandbox) with Chart package

Jack Vice
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:

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
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: cabal.config (sandbox) with Chart package

Imants Cekusins
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 <[hidden email]> 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:

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
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners



_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners