I am new to haskell and I would like to do a seemingly very simple task in it(using wxhaskell).
I would like to change properties based on data acquired from the outside world(i.e real time, typed text etc.). Probably it sounds stupid but I simpy cannot do this for days. I am very confused and it is annoying how a simple task as this is so difficult.
Here are what I tried to do:
Given a text label and a button, Evry time I press the button I'd like to read a system dependent time data(for example getCPUTtime) and write it back on the label.
Given a text label and a timer. Evry time the timer condition fires i'd like to read a system dependent time data...(like above) and write it back
I couldn't do any of these. Mostly because if acquire any data it comes in the form of IO <sometype> and set doesn't accept IO type. So I cannot set the new value.
I coouldn't find any function in the wxhaskell documentation or tutorials that sets anything based on IO types.
I also found a function unsafePerformIO which could convert an IO to a non IO type but I couldn't do it anyway. I almost did the second task but the label didn't refresh by itself. It only refreshed itself when I moved the window along or continually resized it.
Can anybody help me? Ther must be some way to do these things. They cannot be impossible because they are very basic tasks.