[comp.lang.functional] Various Subjects

ses@techunix.BITNET (Simon E Spero) (01/16/91)

Archives:
        I've been away from the net for a couple of months (what a great
day to start work), and I was wondering whether anybody out there archives this
group. If so, can the archive be accessed via Internet?

Haskell:
        Has a shippable version of Yale Haskell been released yet? If so,
where does it live, and if not, is the delay related to problems with T and
large programs? I had a lot of problems of this nature whilst writing part of
a  back end for Lazy Hope+C (and had hoped to borrow any workarounds from
Haskell).

Cookbook:
        Can anybody give me a reference for a transformation cook-book;
something covering various tried and tested transformation tactics? Does one
exist; if not can anyone suggest a good set of review papers?

Global State:
        I've noticed that most programs I've written that maintain a state
tend to have a fairly large number of paramaters which are passed un-inspected
down through various functions, until they finally used, updated, and then
passed back up the chain in a sequence of ever increasing tuples. One idea
I had for dealing with this problem is through the use of some sort of
automatic paramaters. These would be a collection of identifiers that would
be automatically added to each and every function's paramater list and it's
output tuple. Functional calls would have to be expanded into 'let' statements,
and values from one call would be passed into the next. References in let
statements to one of the global identifiers would be replaced by the
appropriate new identifier.

For example: (hopeish notation)

global symtab;

compiler(a,b,c) <=  let coke == addsym(b) in
                    let toke == lookup(a) in
                   (toke,coke,c)

would go to:

compiler(a,b,c,symtab) <=
                let (coke,symtab') == addsym(b,symtab) in
                let (toke,symbtab'') == lookup(a,symtab') in
                (toke,coke,c,symtab'')


        f(g(x),h(x))

would go to:

        let (r1,symtab') == g(x,symtab) in
        let (r2,symtab'') == h(x,symtab') in
        f(r1,r2,symtab'')

addsym(a) <=    let (key,symtab) := insert(a,symtab) in
                key

would go (naively) to:

addsym(a,symtab) <= let (key,symtab') == insert(a,symtab) in
                    (key,symtab')


Unused/unmodifed values could then be removed - much of the work is already
done by strictness analysis.

Before the hidden-state flames start coming in, can I add that this sort of
notational convenience really belongs in an editor, and not in a compiler; the
programmer should be able to swap between one format and the other so that it
remains quite clear where each value is coming from, and so that 'real'
transformations don't need to know about this pseudo-state.

Any comments?

Simon
--
ses@techunix.technion.ac.il | Look at them Iraqis, that's the way you do it,
ses@techunix.bitnet         | Your fire your missles on the CNN.
------------------------------------------------------------------------------
Tel +272-4-292658, Fax +272-4-236212, Tlx 46406  |A Corner of a Foreign field.