I am trying to get Malcolm Wallace's Xtract code to run with Hugs and have
noticed a few inconsistencies between whatever compiler he is using and
hugs...

1. Where `maybe` is exported
His compiler does not export `maybe` from the Maybe library but Hugs
does.  The report says that Maybe should be exported from both.
I think the report is wrong and that `maybe` should only be exported from
Maybe.  In any case, Hugs correctly implements H98 and his compiler does
not.
(MW, you need to hide maybe in ParseSTXml.hs ParseSTHtml.hs and
PPSTXmlNew.hs)

2. Allowing use of qualified names without importing qualified
MW's compiler allows use of Prelude.elem without qualified import of
the prelude.  Hugs does not like that.  I think Hugs is right, but I am
not sure which is "correct".
(MW, the offending line is in Combinators.hs on line 169)

3. Inadequacy of Haskell
There are a few places where MW relies on the preprocessor rather than
Haskell.  Xtract has this code:
---------From ParseSTXml.hs--------
#define PARSEARG(tok)  P (\st inp -> case inp of { \
                                      ((p,tok n):ts) -> [(n,st,ts)]; \
                                      ts -> [] } )
name :: Parser SymTab Token Name
name =  PARSEARG(TokName)

string, freetext :: Parser SymTab Token String
string =   PARSEARG(TokName)
freetext = PARSEARG(TokFreeText)
-------
Is there clean a way of achieving the same functionality without relying
on the preprocessor?

-Alex-

PS If you want to use HUGS to test, you need to pass HUGS a preprocessor:
runhugs +98 -F"python hpp.py" XTract.hs
Here is a short preprocessor in Python:
-------hpp.py-----
import sys,string,os;
cpp = 'gcc -E -xc -traditional -D__HASKELL_98__ '+sys.argv[1];
for line in os.popen(cpp).readlines()[1:]:
  if line:  print line[:-1];
----------------




___________________________________________________________________
S. Alexander Jacobson                   Shop.Com
1-212-697-0184 voice                    The Easiest Way To Shop






Reply via email to