-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Labels
status: needs more infoThis issue needs more info before any action can be done.This issue needs more info before any action can be done.
Description
Hello everyone! I have some experiments with lazy list. But I have some problem.
module Main where
import Prelude (Unit, map, mod, show, ($), (*), (+), (/=), (<<<), (<=))
import Data.List.Lazy (all, filter, repeat, take, iterate, length, takeWhile, (:))
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, log)
import Data.Lazy (defer, force)
main :: Eff (console::CONSOLE) Unit
main = do
-- log <<< show <<< length <<< take 1000000 <<< map (_+10) <<< repeat $ 1 -- works
-- log <<< show <<< length <<< take 10000000 <<< map (_+10) <<< repeat $ 1 -- hard
-- log <<< show <<< length <<< take 100000000 <<< map (_+10) <<< repeat $ 1 -- oh my...
-- log <<< show <<< length <<< take 100000 <<< iterate(_+1) $ 1 -- Maximum call stack size exceeded
-- log <<< show <<< length <<< take 10000 <<< iterate(_+1) $ 1 -- Maximum call stack size exceeded
log <<< show <<< length <<< take 1000 <<< iterate(_+1) $ 1 -- only this code works!!!
As u can see iterate
has some strange behavior. I think this problem in map
here https://github.com/purescript/purescript-lists/blob/master/src/Data/List/Lazy.purs#L189
Or maybe I don't know how use lazy list in purescript. If it is, please help me =)
Metadata
Metadata
Assignees
Labels
status: needs more infoThis issue needs more info before any action can be done.This issue needs more info before any action can be done.