[Yhc] Some more changes to core
Tom Shackell
shackell at cs.york.ac.uk
Sun Aug 5 05:51:40 EDT 2007
Neil Mitchell wrote:
> True, this leads me to the conclusion that in dictionaries we separate
> all pieces with ; - leaving 3 or 4 pieces. I know you can still split
> the dictionary, but by the time you've got 4 ;'s floating around, you
> are a million miles from either Data.Maybe.fromJust or
> Data.Maybe;fromJust - so I think being consistent with Haskell wins.
Well I still prefer my suggestion that all module names be separated
with ';', however, in the interests of making progress I'll agree the
the Neil variant, which gives valid examples as:
- Simple function
Data.Maybe.fromJust
- Local function
Foo.200_bar
- instance dictionary
Foo.Bar;Foo.Bar.Baz;Prelude.Eq
- instance method
Foo.Bar;Foo.Bar.Baz;Prelude.Eq;==
INVARIANT:
- In a simple dotted name (e.g. Data.Maybe.fromJust) the non-module
part of the name may not contain a dot unless the first character
of the name is a non alpha/underscore.
The complication is to accommodate for operators containing '.'
like:
Foo.Bar.+.+
which is of course (Foo.Bar).(+.+). Note that this also works
correctly for local functions that are operators containing '.'.
For example
Foo.Bar.200_+.+
obeys the rule because it starts with a digit and not with an alpha
or an underscore.
I'll have the name conversion routine balk and die on anything that
doesn't conform to one of those 4 forms.
I'll also leave out the import stuff for now, with a view that it's easy
enough to add it later if people do decide they do want it. The
conversion routine is going to generate the same information in either
case, it's just whether it gets put in the core structure or not.
I'll add the new stuff to the primitives, if anyone has any additional
suggestions please say so :-)
> Yes, but:
>
> foo x y = case x of
> _ -> ...
>
> And in another module:
>
> bar x = foo (f x) x
>
> Now the (f x) thunk is still created, then immediately forced.
>
> If we are expanding our .hi file format (which should only be done
> once its binary!) we could add some inlining information as well, esp
> for things like otherwise.
Ah yes if you want separate compilation you need to include the
information in the .hi file, you're quite right :-)
Cheers
Tom
More information about the Yhc
mailing list