[Yhc] Some more changes to core

Neil Mitchell ndmitchell at gmail.com
Sun Aug 5 05:09:48 EDT 2007


Hi

> Of course it's still very easy in the case that it's applied everywhere.
> You split the string based on ';'. If you get two parts its a normal
> name, if you get 3 or 4 parts its a class instance. Three is possible
> because the instance dictionary is generated as
>
>   Foo.Bar;Prelude.Eq;Foo.Bar.Baz = (,) Foo.Bar;Prelude.Eq;Foo.Bar.Baz;==
>                                       Foo.Bar;Prelude.Eq;Foo.Bar.Baz;/=

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.


> > Don't you then pay to create a thunk, then evaluate it later? I
> > thought that this was one of the main costs saved by strictness, which
> > wouldn't be saved by a case transformation.
>
> Conceptually, no
>
>        case f x of
>          _         -> ...
>
> is a perfectly reasonable description to the backend that 'f x' should
> be compiled strictly (i.e. without thunks).

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.

Thanks

Neil


More information about the Yhc mailing list