<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<title></title>
</head>
<body>
<div>
Oh, you're right, thanks.
</div>
<div>
I got lost in types and GHC error messages. :/
</div><br />
Miguel Mitrofanov <miguelimo38@yandex.ru> hat am 26. Dezember 2009 um 18:09 geschrieben:<br />
<br />
> Your code is equivalent to this:<br />
> <br />
> adjustToBox (ObjectWrapper object) box = adjustToBox object box<br />
> <br />
> but what you've probably intended to write was<br />
> <br />
> adjustToBox (ObjectWrapper object) box = ObjectWrapper (adjustToBox  <br />
> object box)<br />
> <br />
> It has nothing to do with existentials - it's a simple type mismatch.<br />
> <br />
> On 26 Dec 2009, at 19:53, haskell@kudling.de wrote:<br />
> <br />
> > Hi all,<br />
> ><br />
> > thanks for the insight.<br />
> ><br />
> > > But you can deconstruct the enclosed value temporarily:<br />
> > ><br />
> > > getSomething :: Bar -> Double<br />
> > > getSomething b =<br />
> > >      case b of<br />
> > >          Bar a -> doSomething a<br />
> ><br />
> > Somehow i fail to apply this.<br />
> ><br />
> > If you look at<br />
> > http://chlor.svn.sourceforge.net/viewvc/chlor/trunk/haskell/Chlor/Object.hs?revision=603&view=markup<br />
> ><br />
> > in line 26 i used this for function "adjustToBox", but i still get:<br />
> ><br />
> > Chlor/Object.hs:33:36:<br />
> >     Couldn't match expected type `ObjectWrapper'<br />
> >            against inferred type `a'<br />
> >       `a' is a rigid type variable bound by<br />
> >           the constructor `ObjectWrapper' at Chlor/Object.hs:33:12<br />
> >     In the expression: adjustToBox object<br />
> >     In a case alternative: ObjectWrapper object -> adjustToBox object<br />
> >     In the expression:<br />
> >         case wrapper of { ObjectWrapper object -> adjustToBox object }<br />
> ><br />
> > :(<br />
> > _______________________________________________<br />
> > Haskell-Cafe mailing list<br />
> > Haskell-Cafe@haskell.org<br />
> > http://www.haskell.org/mailman/listinfo/haskell-cafe<br />
> <br />
</body>
</html>