
On Mon, May 02, 2011 at 09:25:06PM +0000, C Rodrigues wrote:
I'm re-sending this e-mail, hopefully with proper line breaks this time.
I was experimenting with using GADTs for subtyping when I found something interesting. Hopefully someone can satisfy my curiosity.
Here are two equivalent GADTs. My understanding was that GHC would translate "Foo" and "Bar" into isomorphic data types. However, GHC 6.12.3 generates better code for 'fooName' than for 'barName'. In 'fooName', there is no pattern match against 'FooExtra'. In 'barName', there is a pattern match against 'BarExtra'. What makes these data types different?
Not a real answer to your question, but have you tried this with GHC 7.0.3? The type checker changed a lot between 6.12 and 7 and it may now behave more consistently (although I do not know for sure). -Brent