[Haskell-cafe] Evaluation of IO actions in record assignment

Adde adde at trialcode.com
Mon Jul 9 11:07:21 EDT 2007


Hi.
I'm toying around with GTK2Hs and one of the things I'm doing 
is stuffing a bunch of widgets in a record. 
The problem is that the function that fetches a widget from the 
Glade file returns IO Widget while my structure contains Widget's.
The best I've come up with is simply evaluating the actions by 
putting the result in temporaries and then building the record. 
Is there an easier way to accomplish this?

signatureEntry <- xmlGetWidget xml castToEntry "signatureEntry"
passwordEntry <- xmlGetWidget xml castToEntry "passwordEntry"
repeatEntry <- xmlGetWidget xml castToEntry "repeatEntry"
return UserPanel {userPanelSignatureEntry = signatureEntry,
	     	  userPanelPasswordEntry = passwordEntry,
	     	  userPanelRepeatEntry = repeatEntry}

Thanks,
Adde



More information about the Haskell-Cafe mailing list