Orphan Instances
Isaac Dupree
isaacdupree at charter.net
Thu Aug 14 13:22:49 EDT 2008
Simon Peyton-Jones wrote:
> Now when compiling Foo, GHC reads Prelude.hi, and sees that GHC.Map.map is brought into scope. Since that function is *used* in Foo, GHC also reads GHC.Map.hi to find GHC.Map.map's type, unfolding, arity, strictness etc etc. But it doesn't read GHC.Filter.
>
> In the *presence* of orphan modules, perhaps somewhere in the transitive closure of modules imported by Prelude, GHC must read those interface files too. We store a list of all orphan modules transitively below Prelude inside Prelude.hi, precisely so GHC knows which ones to read.
Perhaps Prelude.hi could, instead of storing a *list* of
orphan modules, store all the orphan instances themselves?
Obviously that would waste a bit more space (less now that
instances don't contain big function bodies in the HEAD;
more because RULES can be orphan too, and numerous). Would
it be any faster loading or is it just a bad idea? :-)
-Isaac
More information about the Libraries
mailing list