[Haskell-cafe] Solved but strange error in type inference

Brandon Allbery allbery.b at gmail.com
Tue Jan 3 12:23:36 CET 2012


On Tue, Jan 3, 2012 at 05:50, Yucheng Zhang <yczhang89 at gmail.com> wrote:

> On Tue, Jan 3, 2012 at 6:44 PM, Brandon Allbery <allbery.b at gmail.com>
> wrote:
> > On Tue, Jan 3, 2012 at 05:17, Yucheng Zhang <yczhang89 at gmail.com> wrote:
> >>
> >> subsome :: [RRule nt t s] -> Either String ([t], s)
> >>
> >> It seems to me that the compiler is not sure the two 'nt' are equal.
> >> The ScopedTypeVariables can make the compiler believe they are equal.
> >
> > But ScopedTypeVariables is enabled already.
>
> Sorry, I meant actually using ScopedTypeVariables as in the first function,
> which compiles well:
>
> legSome :: LegGram nt t s -> nt -> Either String ([t], s)
>

Except he's not; an explicit "forall" is needed to indicate the type
variables to be brought into scope.  It would need to be

> legSome :: forall nt t s. LegGram nt t s -> nt -> Either String ([t], s)

-- 
brandon s allbery                                      allbery.b at gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120103/c28b98a6/attachment.htm>


More information about the Haskell-Cafe mailing list