
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I imagine defaulting is involved here. On 09/18/2014 06:00 PM, Audun Skaugen wrote:
I am confused about the behaviour of the AllowAmbiguousTypes extension. I tried the basic example of the user manual:
class C a where f :: C a => Int f = 3 main = print f
Using ghc 7.8.3, without the extension, this will cause a type error at the type signature (line 2). Adding AllowAmbgiuousTypes causes an error at the call site instead (line 4). So far so good.
However, if I replace the (C a) constraint with (Num a), no type error is reported, and the example runs fine! This is true with or without the extension. Using ghc 7.6.3, however, the example is still rejected with an "ambiguous constraint" error.
Is this a bug in ghc 7.8? Is ghc somehow able to prove the Num constraint even though a is universally quantified?
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJUHK7gAAoJEOkNLkFQ6mTVRXwP/iyO0j/6/nrA9Ill4B9xqlBR jvrPNchVjorz3z6CvWpG3CJT/GG3uPDETcyFtw8V0Pbs4kQXDfCYAuSQxorzg2TQ jwZ8tWTo2xEX195YT45ghuohMyWM6DF2Q/Kl4DceU+WnRbJo2hsvYnmdXVN/ZhjU B5woPiqzQSd4b4irhM/uyPt69DbFnq+EmsNtD40V/WSpeczLQCFr+gd9/9KUSM3q LplJGXg2X3992ABt4+8Um+0BW4Gq0i1m3gDKjth6QIBMxoNlVexTKsbqlZAaQBd3 RzB5Gi6uXqWzPJclEyTiRfmDn18Wou7waMzlCH25biFz7uFq6uaLDbilmIiv2kpm Y7ycpC0Zmi2Lrf/hqS5bOaJkz+DvjKgQhGoxsmfWyNfoqTnX0MePTgZ1mbvPnfoQ FMN/J86XPa20m3zOGayUZ/YQ4tNmkC57ssj5mpxilqvgGCHPD/p4GharBfP/eC6M 13j4jpXBZI4m86j/kIoExl7MxWahF+aDoiU5m0w77/1x4x5NSOQ7D62KY8nVqvc7 TcnMEjI4MvJU80EuOwAsDIOR2WnYYV+mh2vYaliS4jC7tCNTZouHAa+uKbh/vVIx ZQVwhm45fp7Du5DZzCwMjxU6lrG3xsDrNVI325EVnxxOn1IyK6VLHz7kOtkd3yRe GHKKTVrSwia2TxhJLc4+ =USJg -----END PGP SIGNATURE-----