(no subject)
Jeffrey R. Lewis
jeff@galconn.com
Fri, 16 Mar 2001 09:49:58 -0800
Jonathon Bell wrote:
> Hi guys,
>
> Thanks for the great work on hugs. I have a possible minor bug. Consider the
> following:
>
> import Prelude()
>
> foo = [(i,j) | i<-[0] | j<-[0]]
>
> Evaluating 'foo' generates the runtime error:
>
> Program error: {foo_zip}
>
> presumably because a call is implicilty being made to the standard prelude
> function zip which i have hidden. This arose because i am using hugs to
> develop my own 'prelude' to simulate an initial environment for a domain
> specific language i am creating, and in this custom langauge zip is defined
> differently. Interestingly, impilcit calls to map' and 'filter' made by the
> list comprehensions don't appear to suffer from the same problem.
Standard list comprehensions are translated directly to the `kernel' language - they don't actually generate implicit calls to map and filter. Parallel comprehensions, however, *do* generate calls to `zip', unfortunately they reference whatever `zip' happens to be in scope. You are right to identify this as a bug. It should generate calls to the Prelude zip. Or, even better, just directly generate `kernel' code.
--Jeff