timbod7 / haskell-chart

A 2D charting library for haskell
429 stars 85 forks source link

Can't build example 1 without using the Easy helper functions #238

Open swarajdash opened 2 years ago

swarajdash commented 2 years ago

I am trying to run example 1 with ghc-8.10.7, Chart-1.9.3, and colour-2.3.6 using the code that doesn't make use of the Easy helper functions. For this line

setLinesBlue :: PlotLines a b -> PlotLines a b
setLinesBlue = plot_lines_style  . line_color .~ opaque blue

I get the following error:

ChartEx.hs:9:50: error:
    • Couldn't match expected type ‘colour-2.3.6:Data.Colour.Internal.AlphaColour
                                      Double’
                  with actual type ‘AlphaColour a2’
      NB: ‘AlphaColour’
            is defined in ‘Data.Colour.Internal’ in package ‘colour-2.3.6’
          ‘colour-2.3.6:Data.Colour.Internal.AlphaColour’
            is defined in ‘Data.Colour.Internal’ in package ‘colour-2.3.6’
    • In the second argument of ‘(.~)’, namely ‘opaque blue’
      In the expression: plot_lines_style . line_color .~ opaque blue
      In an equation for ‘setLinesBlue’:
          setLinesBlue = plot_lines_style . line_color .~ opaque blue
  |
9 | setLinesBlue = plot_lines_style  . line_color .~ opaque blue
  |                                                  ^^^^^^^^^^^

and similar errors for the other two instances of colours in that file. The Easy version works just fine, so I'm confused why I get problems with colours here (and it doesn't even make sense to me what the error is). Has anyone seen this before? Am I missing something?