muesli4 / table-layout

Layout data in grids and pretty tables. Provides a lot of tools to get the cell formatting right (positional alignment, alignment on specific characters and limiting of cell width)..
BSD 3-Clause "New" or "Revised" License
37 stars 11 forks source link

Add grid and table functions which return CMIs #39

Closed Xitian9 closed 1 year ago

Xitian9 commented 2 years ago

Occasionally, the ColModInfo used to generate a table is needed externally. This allows you to get that without copying over all the code manually.

muesli4 commented 2 years ago

When would that be the case? (Background: I was trying to move definitions with more complexity into sub-modules.)

Xitian9 commented 2 years ago

In the hledger package we render some tables, and then later on need to make a line with the same width as some of the columns. If you'd prefer the complexity to be in submodules, I can change the definition of deriveColMods instead. But I don't think unwrapping this one level of wrappers significantly increases code complexity (zipWith ($) is not particularly simpler than zipWith4).

muesli4 commented 1 year ago

I think it is fine. I am trying to keep the types opaque for the users in case they have to be changed later on.

muesli4 commented 1 year ago

This allows you to get that without copying over all the code manually.

Xitian9 commented 1 year ago

Updated.