monomorphic or not?

Simon Peyton-Jones simonpj at microsoft.com
Thu Mar 6 03:56:15 EST 2008


No, it's fine.  compress is indeed monomorphic, but since it's called at exactly one type, namely Char, so it gets the monomorphic type [Char] -> [Char].  That is what the Haskell Report says. (Or tries to.)

Simon


| -----Original Message-----
| From: glasgow-haskell-users-bounces at haskell.org [mailto:glasgow-haskell-users-bounces at haskell.org] On Behalf Of
| John Meacham
| Sent: 06 March 2008 07:26
| To: glasgow-haskell-users at haskell.org
| Subject: monomorphic or not?
|
| http://www.cse.unsw.edu.au/~dons/code/nobench/real/compress/compress.hs
|
| if you notice this program has the line
|
| > compress = map toEnum . codes_to_ascii . encode
|
| It seems to me this should run afoul of the monomorphism restriction due
| to the unknown ambiguous type in Enum, but ghc 6.8.2 happily accepts it.
| Jhc thinks it is illegal according to my reading of the specification.
| Any ideas about what is going on here?
|
|         John
|
| --
| John Meacham - ⑆repetae.net⑆john⑈
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users at haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


More information about the Glasgow-haskell-users mailing list