X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fdocs%2Fusers_guide%2Fbugs.sgml;h=60cadd5daa259a0f6689abc392174d5394e0ef8d;hb=5affd8114e7ba87fa289eb72760a597456aea4cb;hp=dc7dee37cefb5828a4fc5d335f102f3df3352c15;hpb=6d866f880a0f71e9dd293faf981dd2f5bca2c0fd;p=ghc-hetmet.git diff --git a/ghc/docs/users_guide/bugs.sgml b/ghc/docs/users_guide/bugs.sgml index dc7dee3..60cadd5 100644 --- a/ghc/docs/users_guide/bugs.sgml +++ b/ghc/docs/users_guide/bugs.sgml @@ -1,13 +1,12 @@ - Known bugs and infelicities - + Known bugs and infelicities - - Haskell 98 vs. Glasgow Haskell: language non-compliance + <sect1 id="vs-Haskell-defn"> + <title>Haskell 98 vs. Glasgow Haskell: language non-compliance - - GHC vs the Haskell 98 language - Haskell 98 language vs GHC + + GHC vs the Haskell 98 language + Haskell 98 language vs GHC This section lists Glasgow Haskell infelicities in its implementation of Haskell 98. See also the “when things @@ -40,16 +39,6 @@ single qualified operator rather than the two lexemes M and .\. - - - When is on, GHC - reserves several keywords beginning with two underscores. - This is due to the fact that GHC uses the same lexical - analyser for interface file parsing as it does for source - file parsing, and these keywords are used in interface - files. Do not use any identifiers beginning with a double - underscore in mode. - @@ -86,48 +75,19 @@ Expressions and patterns - - - Very long String constants: - - May not go through. If you add a “string - gap” every few thousand characters, then the strings - can be as long as you like. - - Bear in mind that string gaps and the - - option don't mix very well (see - ). - - - - + None known. Declarations and bindings None known. - - - - Module system and interface files - - - - - Namespace pollution - - Several modules internal to GHC are visible in the - standard namespace. All of these modules begin with - Prel, so the rule is: don't use any - modules beginning with Prel in your - program, or you may be comprehensively screwed. - - - - + + + Module system and interface files + + None known. @@ -151,7 +111,7 @@ main = print (array (1,1) [(1,2), (1,3)]) - In Prelude support + In <literal>Prelude</literal> support @@ -168,19 +128,33 @@ main = print (array (1,1) [(1,2), (1,3)]) - Arbitrary-sized tuples: + Arbitrary-sized tuples - Tuples are currently limited to size 61. HOWEVER: + Tuples are currently limited to size 100. HOWEVER: standard instances for tuples (Eq, Ord, Bounded, Ix Read, and Show) are available - only up to 5-tuples. + only up to 16-tuples. This limitation is easily subvertible, so please ask if you get stuck on it. + + + Reading integers + + GHC's implementation of the + Read class for integral types accepts + hexadeciaml and octal literals (the code in the Haskell + 98 report doesn't). So, for example, +read "0xf00" :: Int + works in GHC. + A possible reason for this is that readLitChar accepts hex and + octal escapes, so it seems inconsistent not to do so for integers too. + + @@ -265,67 +239,90 @@ main = print (array (1,1) [(1,2), (1,3)]) - - - - - - - Known bugs or infelicities - -GHC has the following known bugs or infelicities: - - - -GHC only provides tuples up to size 62, and derived tuple instances (for -Eq, Ord, etc) up to size 15. - - - -GHC can warn about non-exhaustive or overlapping patterns, and usually does so correctly. -But not always. It gets confused by string patterns, and by guards, and can then -emit bogus warnings. The entire overlap-check code needs an overhaul really. - - - - -Dangers with multiple Main modules. - - - GHC does not insist that module Main lives in a file called Main.hs. - This is useful if you want multiple versions of Main. But there's a danger: when - compiling module Main (regardless of what file it comes from), GHC looks for - the interface Main.hi; it uses this to get version information from the last - time it recompiled Main. The trouble is that this Main.hi - may not correspond to the source file being compiled. - - - Solution: remove Main.hi first. A better solution would be for GHC to - record the source-file filename in the interface file, or even an MD5 checksum. - - + + + + + + Known bugs or infelicities + + In addition to the divergences from the Haskell 98 standard + listed above, GHC has the following known bugs or + infelicities. + + + + GHC can warn about non-exhaustive or overlapping + patterns (see , and usually + does so correctly. But not always. It gets confused by + string patterns, and by guards, and can then emit bogus + warnings. The entire overlap-check code needs an overhaul + really. + + + + Dangers with multiple Main + modules. + + GHC does not insist that module Main + lives in a file called Main.hs. This is + useful if you want multiple versions of + Main. But there's a danger: when compiling + module Main (regardless of what file it + comes from), GHC looks for the interface + Main.hi; it uses this to get version + information from the last time it recompiled + Main. The trouble is that this + Main.hi may not correspond to the source + file being compiled. + + Solution: remove Main.hi first. A + better solution would be for GHC to record the source-file + filename in the interface file, or even an MD5 checksum. + + - - -GHCi does not respect the default declaration in the module whose -scope you are in. Instead, for expressions typed at the command line, you always -get the default default-type behaviour; that is, default(Int,Double). - - -It would be better for GHCi to record what the default settings in each module are, and -use those of the 'current' module (whatever that is). - - - -GHCi does not keep careful track of what instance declarations are 'in scope' if they -come from other packages. -Instead, all instance declarations that GHC has seen in other packages are all in scope -everywhere, whether or not the module from that package is used by the command-line expression. - - - -GHC's inliner can be persuaded into non-termination using the standard way to encode -recursion via a data type: + + GHC does not allow you to have a data type with a context + that mentions type variables that are not data type parameters. + For example: + + data C a b => T a = MkT a + + so that MkT's type is + + MkT :: forall a b. C a b => a -> T a + + In principle, with a suitable class declaration with a functional dependency, + it's possible that this type is not ambiguous; but GHC nevertheless rejects + it. The type variables mentioned in the context of the data type declaration must + be among the type parameters of the data type. + + + + GHCi does not respect the default + declaration in the module whose scope you are in. Instead, + for expressions typed at the command line, you always get the + default default-type behaviour; that is, + default(Int,Double). + + It would be better for GHCi to record what the default + settings in each module are, and use those of the 'current' + module (whatever that is). + + + + GHCi does not keep careful track of what instance + declarations are 'in scope' if they come from other packages. + Instead, all instance declarations that GHC has seen in other + packages are all in scope everywhere, whether or not the + module from that package is used by the command-line + expression. + + + + GHC's inliner can be persuaded into non-termination + using the standard way to encode recursion via a data type: data U = MkU (U -> Bool) @@ -335,17 +332,19 @@ recursion via a data type: x :: Bool x = russel (MkU russel) -We have never found another class of programs, other than this contrived one, that makes GHC -diverge, and fixing the problem would impose an extra overhead on every compilation. So the -bug remains un-fixed. There is more background in - -Secrets of the GHC inliner. - - - - - + + We have never found another class of programs, other + than this contrived one, that makes GHC diverge, and fixing + the problem would impose an extra overhead on every + compilation. So the bug remains un-fixed. There is more + background in + Secrets of the GHC inliner. + + + + +