[Haskell-cafe] Proposal: Non-recursive let

David Fox dsf at seereason.com
Thu Jul 25 16:31:49 CEST 2013


On Wed, Jul 24, 2013 at 1:11 AM, Andreas Abel <andreas.abel at ifi.lmu.de> wrote:
> On 23.07.13 4:34 AM, Richard A. O'Keefe wrote:
>>
>>
>> On 22/07/2013, at 8:14 PM, Andreas Abel wrote:
>>
>>> Just today, my student asked me why the following program does nothing:
>>
>>
>> Did you ask your student why their code should not be torn into pieces,
>> burned to ashes, and incorporated into a pot for radioactive waste?
>>
>> All those occurrences of unsafePerformIO!
>
>
> No, here they are intended, to simulate something like uniqueness types in
> Clean, which incidentially has been mentioned on this thread before.
>
> The loop has nothing to do with unsafePerformIO, but stems from Haskell's
> idiosyncratic recursive let, which is a trap for all that come from another
> functional language.

Have your students turn on -fwarn-name-shadowing -Werror:

[1 of 1] Compiling Main             ( foo.hs, interpreted )

foo.hs:53:16: Warning:
    This binding for `arr' shadows the existing binding
      bound at foo.hs:50:28

foo.hs:62:18: Warning:
    This binding for `arr' shadows the existing binding
      bound at foo.hs:56:24




More information about the Haskell-Cafe mailing list