newtype of newtype

Simon Peyton-Jones simonpj at microsoft.com
Wed Mar 17 08:59:50 EST 2004


Now fixed properly in the head (and 6.2)

| -----Original Message-----
| From: glasgow-haskell-bugs-bounces at haskell.org
[mailto:glasgow-haskell-bugs-
| bounces at haskell.org] On Behalf Of Ross Paterson
| Sent: 15 March 2004 17:27
| To: glasgow-haskell-bugs at haskell.org
| Subject: newtype of newtype
| 
| The following little module:
| 
| 	module Bug where
| 
| 	newtype Foo = Foo [Foo]
| 	newtype Bar = Bar Foo
| 
| 	unBar :: Bar -> Foo
| 	unBar (Bar x) = x
| 
| fails core-lint in both 6.2 and the HEAD:
| 
| *** Core Lint Errors: in result of Desugar ***
| Bug.hs:7:
|     [RHS of x :: Bug.Foo]
|     The type of this binder doesn't match the type of its RHS: x
|     Binder's type: Bug.Foo
|     Rhs type: Bug.Bar
| *** Offending Program ***
| Rec {
| unBar :: Bug.Bar -> Bug.Foo
| unBar = \ ds_dch :: Bug.Bar ->
|           let {
|             x :: Bug.Foo
|             x = ds_dch
|           } in  x
| Bug.unBar :: Bug.Bar -> Bug.Foo
| Bug.unBar = unBar
| end Rec }
| 
| *** End of Offense ***
| _______________________________________________
| Glasgow-haskell-bugs mailing list
| Glasgow-haskell-bugs at haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


More information about the Glasgow-haskell-bugs mailing list