dear-imgui.hs icon indicating copy to clipboard operation
dear-imgui.hs copied to clipboard

Provide wrapped functions with all the options exposed

Open dpwiz opened this issue 3 years ago • 1 comments

A follow-up to #52, but can be done concurrently.

The current functions can remain intact and a new set of functions can be added as a cheap wrapper for raw procedures.

-- current
withWindowOpen :: MonadUnliftIO m => String -> m () -> m ()

-- proposed
withWindowOpen' :: (MonadUnliftIO m, StateVar Bool isOpen) => ImGuiWindowFlags -> isOpen -> String -> m () -> m ()

Fancy wrappers (labels, lenses, etc.) can be provided as alternatives in their own packages.

Cons: this will double the amount of functions published. The previous implementation, however, can be rebased upon those new expanded.

Alternative 1: Add all the arguments to existing functions. A breaking change, a bit noisier to write but lighter on maintenance.

Alternative 2: Rename current shortcuts to underscored, add expanded versions like in A1. Also a breaking change and may require breakage again when "expandable defaults" are to be implemented.

dpwiz avatar Jun 15 '21 18:06 dpwiz

It is possible to put expanded version in a separate module, so "sensible default" shortcuts would stay at their place, and special scenarios could incorporate something like DearImGui.LowLevel.

UPD: As DearImGui.Raw exists already, we would expand them, and then add aforementioned LowLevel module, on which sensible defaults are built.

chekoopa avatar Nov 07 '21 09:11 chekoopa