Skip to content

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

@cblp

Description

@cblp

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions