Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is relation between PickFn, LayoutPick and Renderable? #219

Open
cblp opened this issue Jun 3, 2020 · 0 comments
Open

What is relation between PickFn, LayoutPick and Renderable? #219

cblp opened this issue Jun 3, 2020 · 0 comments

Comments

@cblp
Copy link

cblp commented Jun 3, 2020

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:

  1. 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.

  2. 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 to PickFn (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?

@cblp cblp changed the title What is relation between PickFn and LayoutPick? What is relation between PickFn, LayoutPick and Renderable? Jun 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant