Strangeness in the syntax of types

Niklas Broberg niklas.broberg at gmail.com
Thu Jun 18 19:19:50 EDT 2009


> You're not looking at the latest version of the code. I'm guessing
> you're looking at the stable version instead of the HEAD.

Indeed, I'm looking at the source distribution for 6.10.3, since
that's the reference version I use to test the files.

>> ctypedoc :: { LHsType RdrName }
>>       : 'forall' tv_bndrs '.' ctypedoc        { LL $ mkExplicitHsForAllTy $2 (noLoc []) $4 }
>>       | context '=>' ctypedoc         { LL $ mkImplicitHsForAllTy   $1 $3 }
>>       -- A type of form (context => type) is an *implicit* HsForAllTy
>>       | ipvar '::' type               { LL (HsPredTy (HsIParam (unLoc $1) $3)) }
>>       | typedoc                       { $1 }
>
> This should accept both
>
>> multipleCtx :: (Eq a => Show a => a)
>> multipleCtx = undefined
>
> and
>
>> multipleCtx :: Eq a => Show a => a
>> multipleCtx = undefined
>
> The reason why ctypedoc and ctype were so different before, is because
> they drifted apart after ctypedoc was added. ctype was changed (I
> think during implementation of the TypeFamilies extension) without any
> changes to ctypedoc. This was fixed in HEAD not so long ago.

Thanks a lot for the information, then I know. So the correct thing to
do is to put a ctype in the recursive position after the context. I
sorely wish these things were better documented...

Cheers,

/Niklas


More information about the Glasgow-haskell-users mailing list