[nhc-bugs] nhc98 rejects legal rebinding

Thomas Hallgren hallgren@cse.ogi.edu
Wed, 21 May 2003 15:08:13 -0700


Hi,

When I compile the following module,

    module Rebind where

    f x = x
      where
        x = True


nhc98-1.16 [1] produces the error message

    ======  Errors when renaming:
    Redefinition of Identifier x at 5:5

While this is not completely unreasonable, it seems to be a deviation 
from the Haskell 98 report and the behaviour of other Haskell 
implementations.

(If I understand the Haskell 98 report correctly, function bindings 
translate to simpler bindings with case expressions in the rhs, and case 
branches with "where" clauses translate to simpler branches with "let" 
bindings in the rhs. Thus, variables introduced in "where" clauses 
should shadow variables in patterns, not clash with them.)

-- 
Thomas H

[1] ftp://ftp.cs.york.ac.uk/pub/haskell/nhc98/nhc98-1.16-ix86-Linux.tar.gz