What is relation between PickFn, LayoutPick and Renderable?
They are incompatible, and it makes it hard to combine grids of different layouts (see #217).
I'm trying to make them compatible. I have two hypotheses:
-
If LayoutPick and PickFn are on the same level of abstraction, then why they are not compatible? I don't see an easy way to convert between a function and a structure.
-
If they are entities of different "kinds", then LayoutPick may be wrapped in PickFn with
const . Just, but I don't think this is a proper way, because this leads toPickFn (PickFn (LayoutPick _))in rendering functions.
When I use functions like this:
renderableToFile def "/tmp/a.png"
:: Renderable a -> IO (PickFn a)
renderableToFile def "/tmp/a.png" $ gridToRenderable $ layoutToGrid def
:: (PlotValue x, PlotValue y) =>
IO (PickFn (LayoutPick x y y))
it looks like they are on different levels, and Renderable expects the argument to be LayoutPick to wrap it then in PickFn.
But when I use
pieChartToRenderable :: forall a. PieChart -> Renderable (PickFn a)
it happens that Renderable expects its argument to be PickFn! To wrap it into what?
renderableToFile def "/tmp/a.png" $ pieChartToRenderable def
:: IO (PickFn (PickFn a))
Double PickFn?