[Haskell-cafe] Avoid sharing
Brandon Allbery
allbery.b at gmail.com
Mon Nov 7 21:00:48 UTC 2016
On Mon, Nov 7, 2016 at 2:56 PM, Michael Roth <list at 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 at gmail.com ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20161107/dc5737a1/attachment.html>
More information about the Haskell-Cafe
mailing list