[Haskell-cafe] Avoid sharing
list at mroth.net
Mon Nov 7 19:56:54 UTC 2016
Hello! A short question, given:
data Seed = ...
data Value = ...
someGenerator :: Seed -> [Value]
createTwo :: Seed -> ([Value], [Value])
createTwo s = (as, bs) where
as = someGenerator s
bs = drop 1000000000 (someGenerator s)
Is it guaranteed that 'someGenerator s' is created twice and not shared
between 'as' and 'bs'? Is this by language design? Are there any GHC
options that change the behaviour?
More information about the Haskell-Cafe