Haskell Gtk2hs中的组合框编译错误
如何使用Gtk2hs处理组合框? 在第页,我找到了一个解决方案:Haskell Gtk2hs中的组合框编译错误,haskell,combobox,gtk2hs,Haskell,Combobox,Gtk2hs,如何使用Gtk2hs处理组合框? 在第页,我找到了一个解决方案: store <- listStoreNew ["green", "yellow", "..."] comboElem <- comboBoxNewWithModel store ren <- cellRendererTextNew cellLayoutPackEnd comboElem ren True cellLayoutSetAttributes comboElem ren store (\txt -&g
store <- listStoreNew ["green", "yellow", "..."]
comboElem <- comboBoxNewWithModel store
ren <- cellRendererTextNew
cellLayoutPackEnd comboElem ren True
cellLayoutSetAttributes comboElem ren store
(\txt -> [cellText := Just txt])
我怎样才能解决这个问题
提前感谢似乎没有
可能字符串的实例。它可能在某一点上有错误,但您应该能够只使用cellText:=txt
。如果出于任何原因需要使用可能字符串
,您可以自己实现该实例。可能更多的是cellText
的属性类型在某个点(在某些Gtk2HS版本中)从GlibString a=>可能a
更改为GlibString a=>a
。
Main.hs:36:17:
No instance for (System.Glib.UTFString.GlibString (Maybe [Char]))
arising from a use of ‘cellText’
In the first argument of ‘(:=)’, namely ‘cellText’
In the expression: cellText := Just txt
In the expression: [cellText := Just txt]