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