foldr/build rule doesn't fire because build is floated out early :-(

Marcin 'Qrczak' Kowalczyk qrczak@knm.org.pl
10 Apr 2001 18:50:00 GMT


------------------------------------------------------------------------
module Test where

import MArray

test1:: IOUArray Int Int -> IO ()
test1 arr = sequence_ [writeArray arr i i | i <- [0..9]]

test2:: IOUArray Int Int -> IO ()
test2 arr = foldr fill (return ()) [0..9]
    where
    fill i next = writeArray arr i i >> next
------------------------------------------------------------------------

Both cases create appropriate foldr/build constructions, but then
build is floated out to the top level, before it would get matched
with the foldr. (Or it's not matched for some unknown reason.)

-- 
 __("<  Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK