Hi, I'm working on building a scatterPlot module for one of my Elm projects.
This works (assigning Sp.defaultProps into defaultProps)
import ScatterPlot as Sp
defaultProps = Sp.defaultProps
init : (Model, Cmd Msg)
init =
( Model
{ defaultProps
| series =
[ { x = 0, y = 1000 }
, { x = 1, y = 800 }
, { x = 2, y = 700 }
, { x = 3, y = 630 }
, { x = 4, y = 590 }
, { x = 5, y = 530 }
, { x = 6, y = 500 }
, { x = 7, y = 480 }
]
, xRange = { lower = 0, upper = 10 }
, yRange = { lower = 0, upper = 1000 }
, chartWidth = 400
, chartHeight = 200
}
, Cmd.none
)
But this throws a compiler error
import ScatterPlot as Sp
init : (Model, Cmd Msg)
init =
( Model
{ Sp.defaultProps
| series =
[ { x = 0, y = 1000 }
, { x = 1, y = 800 }
, { x = 2, y = 700 }
, { x = 3, y = 630 }
, { x = 4, y = 590 }
, { x = 5, y = 530 }
, { x = 6, y = 500 }
, { x = 7, y = 480 }
]
, xRange = { lower = 0, upper = 10 }
, yRange = { lower = 0, upper = 1000 }
, chartWidth = 400
, chartHeight = 200
}
, Cmd.none
)
I ran into something unexpected when parsing your code! 23| {
Sp.defaultProps ^ I am looking for one of the following things: a closing
bracket '}' a lower case name whitespace
It'd be nice to use Sp.defaultProps to be more succinct and keep the new
name space clean, but I haven't figured out how to do this yet.
this is my implementation in ScatterPlot.elm
module ScatterPlot exposing (Point, Series, Range, Props, defaultProps,
scatterPlot)
defaultProps : Props
defaultProps =
{ series = []
, xRange = { lower = 0, upper = 100 }
, yRange = { lower = 0, upper = 100 }
, chartHeight = 100
, chartWidth = 100
}
Thanks for any help; just starting in elm and working to get comfortable
with modularizing code.
--
You received this message because you are subscribed to the Google Groups "Elm
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.