<!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&#39;re right, thanks.
    </div>

    <div>
      I got lost in types and GHC error messages. :/
    </div><br />
    Miguel Mitrofanov &lt;miguelimo38@yandex.ru&gt; hat am 26. Dezember 2009 um 18:09 geschrieben:<br />
    <br />
    &gt; Your code is equivalent to this:<br />
    &gt; <br />
    &gt; adjustToBox (ObjectWrapper object) box = adjustToBox object box<br />
    &gt; <br />
    &gt; but what you&#39;ve probably intended to write was<br />
    &gt; <br />
    &gt; adjustToBox (ObjectWrapper object) box = ObjectWrapper (adjustToBox&#160; <br />
    &gt; object box)<br />
    &gt; <br />
    &gt; It has nothing to do with existentials - it&#39;s a simple type mismatch.<br />
    &gt; <br />
    &gt; On 26 Dec 2009, at 19:53, haskell@kudling.de wrote:<br />
    &gt; <br />
    &gt; &gt; Hi all,<br />
    &gt; &gt;<br />
    &gt; &gt; thanks for the insight.<br />
    &gt; &gt;<br />
    &gt; &gt; &gt; But you can deconstruct the enclosed value temporarily:<br />
    &gt; &gt; &gt;<br />
    &gt; &gt; &gt; getSomething :: Bar -&gt; Double<br />
    &gt; &gt; &gt; getSomething b =<br />
    &gt; &gt; &gt;&#160; &#160; &#160; case b of<br />
    &gt; &gt; &gt;&#160; &#160; &#160; &#160; &#160; Bar a -&gt; doSomething a<br />
    &gt; &gt;<br />
    &gt; &gt; Somehow i fail to apply this.<br />
    &gt; &gt;<br />
    &gt; &gt; If you look at<br />
    &gt; &gt; http://chlor.svn.sourceforge.net/viewvc/chlor/trunk/haskell/Chlor/Object.hs?revision=603&amp;view=markup<br />
    &gt; &gt;<br />
    &gt; &gt; in line 26 i used this for function &quot;adjustToBox&quot;, but i still get:<br />
    &gt; &gt;<br />
    &gt; &gt; Chlor/Object.hs:33:36:<br />
    &gt; &gt;&#160; &#160; &#160;Couldn&#39;t match expected type `ObjectWrapper&#39;<br />
    &gt; &gt;&#160; &#160; &#160; &#160; &#160; &#160; against inferred type `a&#39;<br />
    &gt; &gt;&#160; &#160; &#160; &#160;`a&#39; is a rigid type variable bound by<br />
    &gt; &gt;&#160; &#160; &#160; &#160; &#160; &#160;the constructor `ObjectWrapper&#39; at Chlor/Object.hs:33:12<br />
    &gt; &gt;&#160; &#160; &#160;In the expression: adjustToBox object<br />
    &gt; &gt;&#160; &#160; &#160;In a case alternative: ObjectWrapper object -&gt; adjustToBox object<br />
    &gt; &gt;&#160; &#160; &#160;In the expression:<br />
    &gt; &gt;&#160; &#160; &#160; &#160; &#160;case wrapper of { ObjectWrapper object -&gt; adjustToBox object }<br />
    &gt; &gt;<br />
    &gt; &gt; :(<br />
    &gt; &gt; _______________________________________________<br />
    &gt; &gt; Haskell-Cafe mailing list<br />
    &gt; &gt; Haskell-Cafe@haskell.org<br />
    &gt; &gt; http://www.haskell.org/mailman/listinfo/haskell-cafe<br />
    &gt; <br />
  </body>
</html>