Re: nhc98



About this list Date view Thread view Subject view Author view

malcolm-nhc@cs.york.ac.uk
Wed, 30 Aug 2000 10:02:55 +0100


> I have some trouble exporting the following instances with nhc98: > > module Matrix ((+),(-)) where > > instance (Num a) => Num [a] where > (+) a b = zipWith (+) a b > (-) a b = zipWith (-) a b > > In general I cannot export new instances, e.g. larger tuples for > Eq,Show, etc. Yes, the problem here is a bug in nhc98. The compiler tries to be clever: by default it does not re-export Prelude definitions from any module, since it is reasonable to assume that they are always in scope anyway. However, when you write an instance of a Prelude class for a Prelude type in your non-Prelude module, nhc98 silently fails to export it. There is an easy workaround: add the -prelude option to the compiler commandline. This instructs nhc98 to keep all prelude definitions in the exports. Regards, Malcolm


About this list Date view Thread view Subject view Author view