RE: Prelude and (:) and []((:), []) bugs?
As far as I can tell, the report doesn't allow (:) or []((:), []) in the export list, yet the hugs prelude has the first and the GHC prelude has the second. Have I missed something that allows them or is this a bug in the preludes or the report?
(:) is allowed in an export list; it is just a normal operator. GHC has a couple of extensions to export lists: we allow gcon instead of just qcon, and gtycon instead of qtycon. These are quite natural extensions, and just reduce the amount of built-in compiler magic needed to express the Prelude. Cheers, Simon
On Thu, Sep 20, 2001 at 01:32:54PM +0100, Simon Marlow wrote:
As far as I can tell, the report doesn't allow (:) or []((:), []) in the export list, yet the hugs prelude has the first and the GHC prelude has the second. Have I missed something that allows them or is this a bug in the preludes or the report?
(:) is allowed in an export list; it is just a normal operator.
An export is export -> qvar | qtycon [(..) | ( qcname1 , ... , qcnamen )] (n>=0) | qtycls [(..) | ( qvar1 , ... , qvarn )] (n>=0) | module modid and we need to match (:). We can clearly reduce this to export -> qvar | qtycon | qtycls Now apply qvar -> qvarid | ( qvarsym ) qtycon -> [ modid . ] tycon qtycls -> [ modid . ] tycls export -> qvarid | ( qvarsym ) | [modid .] tycon | [modid .] tycls Apply qvarid -> [ modid . ] varid qvarsym -> [ modid . ] varsym export -> [ modid . ] varid | ( [ modid . ] varsym ) | [ modid . ] tycon | [ modid . ] tycls As there is no . we can reduce this to export -> varid | ( varsym ) | tycon | tycls Now varid -> (small {small | large | digit | ' })<reservedid> and ( is not in small, so we can eliminate that. tycon -> conid, tycls -> conid and conid -> large {small | large | digit | ' } ( is also not in large, so we can eliminate that. Therefore we need to match : with varsym. But varsym -> ( symbol {symbol | :})<reservedop> and reservedop -> .. | : | :: | = | \ | | | <- | -> | @ | ~ | => Did I screw up somewhere?
GHC has a couple of extensions to export lists: we allow gcon instead of just qcon, and gtycon instead of qtycon. These are quite natural extensions, and just reduce the amount of built-in compiler magic needed to express the Prelude.
I think it would be nice if the prelude was valid Haskell 98 - if these extensions are useful and natural, and as I can't see how they could break existing code, could they be put into the revised report? Thanks Ian
participants (2)
-
Ian Lynagh -
Simon Marlow