On Mon, Nov 7, 2016 at 2:56 PM, Michael Roth <list@mroth.net> wrote:
      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?

It's not specified in any standard, but ghc will only share something that is directly bound. There is no sensible way to determine sharing automatically that will do what everyone expects, so ghc doesn't try: the programmer is expected to use bindings to specify sharing.

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net