[Haskell-cafe] still wrestling with io
Seth Gordon
sethg at ropine.com
Thu Feb 8 11:49:25 EST 2007
Martin DeMello wrote:
> Code here: http://zem.novylen.net/anagrid.html
>
> I've got an instance of IO appearing unexpectedly and I can't figure
> out where from. It throws up the following error:
>
> $ ghc --make test.hs
> Chasing modules from: test.hs
> Compiling Main ( test.hs, test.o )
>
> test.hs:38:15:
> Couldn't match `StaticText ()' against `IO (StaticText ())'
> Expected type: StaticText ()
> Inferred type: IO (StaticText ())
> In the application `staticText p [text := (labelText a b)]'
> In the definition of `textOf':
> textOf p a b = staticText p [text := (labelText a b)]
According to the
http://wxhaskell.sourceforge.net/doc/Graphics.UI.WX.Controls.html page,
"staticText" has the type signature "Window a -> [Prop (StaticText ())]
-> IO (StaticText ())". Your textOf function has the type signature
"Panel () -> String -> Anagrams -> StaticText ()". Your textOf
*definition*, therefore, something of type "StaticText()" left side and
type "IO (StaticText ())" on the right. The compiler doesn't like that.
More information about the Haskell-Cafe
mailing list