GADT Type Checking GHC 6.10 versus older GHC
Dominic Steinitz
dominic.steinitz at blueyonder.co.uk
Fri Nov 28 04:12:59 EST 2008
Simon Peyton-Jones wrote:
> | > arbitrarySeq :: Sequence a -> Gen RepSeqVal
> | > arbitrarySeq Nil =
> | > return (RepSeqVal Nil Empty)
> | > arbitrarySeq (Cons (CTMandatory (NamedType n i t)) ts) =
> | > do u <- arbitraryType t
> | > us <- arbitrarySeq ts
> | > case u of
> | > RepTypeVal a v ->
> | > case us of
> | > RepSeqVal bs vs ->
> | > return (RepSeqVal (Cons (CTMandatory (NamedType n i a)) bs) (v:*:vs))
> |
> |
> | > QuickTest.lhs:240:13:
> | > GADT pattern match in non-rigid context for `Nil'
> | > Solution: add a type signature
> | > In the pattern: Nil
> | > In the definition of `arbitrarySeq':
> | > arbitrarySeq Nil = return (RepSeqVal Nil Empty)
>
> That looks odd to me. But it's hard to help without having the code. If you send it I'll try to help.
>
> | > Did you try giving a type signature to the (entire) case expression,
> | > as I suggested? That should do it.
> | >
> |
> | I'm not sure what this means or how to do it. Can you give an example or
> | is it buried in some earlier email? I will go and have another look.
>
> I mean replace
> (case blah of { ... })
> by
> (case blah of { ... }) :: type-sig
>
> That is, attach a type signature to the case expression itself. Does that help at least explain what the sentence means? If so would you like to clarify the wiki advice?
>
> Thanks
>
> Simon
>
>
Simon,
I'm sorry to have put you to so much trouble by accidentally using an
old version of ghc I must have had lying around. As penance, I will go
and update the wiki with what I have learnt.
Dominic.
More information about the Glasgow-haskell-users
mailing list