exprType and existentials
Andrew Farmer
afarmer at ittc.ku.edu
Thu Jun 13 05:20:07 CEST 2013
Calling `exprType` on:
case enumFromStepN
Int
$fNumInt
(I# 1)
(I# 1)
x of wild
Stream s1 ostep t ds1 -> Left s1 ((Int, (Int, Int)), s1) t
gives:
Either s1 ((Int, (Int, Int)), s1)
Which is problematic, as the type variable 's1' is unbound outside of the
alternative RHS!
Unfolding the scrutinee and case-reducing gives:
Left (Int, Int) ((Int, (Int, Int)), (Int, Int))
((,)
Int
Int
(I# 1)
(case x of n1
I# ipv ? n1))
Calling `exprType` now gives:
Either (Int, Int) ((Int, (Int, Int)), (Int, Int))
That is, `s1` was `(Int, Int)` in this case.
Is it expected that `exprType` behaves this way? Or should I file a ticket?
I realize the type of the scrutinee (in this case Stream Int) gives no
indication as to the existential type... and I'm not sure how you would get
it without making exprType do some kind of evaluation, but it would be nice
if exprType at least failed if it doesn't have enough information...
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130612/6269b48c/attachment.htm>
More information about the ghc-devs
mailing list