fltkhs icon indicating copy to clipboard operation
fltkhs copied to clipboard

get/setSize types disagree

Open mitchellwrosen opened this issue 5 years ago • 5 comments

getSize :: Ref _ -> IO Int
setSize :: Size -> IO ()

mitchellwrosen avatar Apr 23 '19 19:04 mitchellwrosen

Whoops, I could be wrong about this one. I forget what widget I was looking at when I made the ticket, but for the Input widget, it really does have

int Fl_Input_::size() const
void Fl_Input_::size	(int W, int H)		

mitchellwrosen avatar Apr 24 '19 16:04 mitchellwrosen

(heh, because getSize gets the length of the text whereas setSize sets the size of the widget)

mitchellwrosen avatar Apr 24 '19 16:04 mitchellwrosen

Ah yes, that makes sense. And actually this OO overloading (specifically being able to have two methods with the same name and completely different type signatures) that's common place in C++ is quite difficult to deal with Haskell and motivated most of the design. None of the existing literature addressed this. The gi-* packages use OverloadedLabels but that's a dangerous extension and I didn't want that in the codebase. OverloadedRecordFields could be a good step forward but I haven't had the time and the migration effort is pretty significant.

deech avatar Apr 24 '19 16:04 deech

Yup, very tricky to design around in Haskell for sure. I've been working on a simplified interface to fltkhs that probably will never become complete enough to release, but I do think there is enough complexity in fltkhs to warrant an opinionated Haskellier wrapper that trades power for simplicity.

mitchellwrosen avatar Apr 24 '19 17:04 mitchellwrosen

Totally! Here to help if you need it.

deech avatar Apr 24 '19 17:04 deech