[GHC] #12620: Allow the user to prevent floating and CSE
GHC
ghc-devs at haskell.org
Thu Oct 6 00:23:09 UTC 2016
#12620: Allow the user to prevent floating and CSE
-------------------------------------+-------------------------------------
Reporter: nomeata | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #9520, #8457 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by edsko):
Replying to [comment:25 simonpj]:
> > Any thunk of type `Sink` never gets updated.
> Notice the "`-o`", meaning a "one-shot function". The idea is that one-
shot functions are called at most once. (Maybe exactly once, but I think
at-most once is better.)
>
> So in your `countFrom` example, the continuation `k` would not be
floated outside the lambda; and if it was written outside it'd be floated
inside the lambda.
>
> GHC already has the notion of a one-shot lambda; it's just not dignified
as part of the type system.
>
> Would that serve? I think that you do intend that the argujment of
`Await` is called at most once, don't you?
Typically, yes, but not necessarily. After all, in the minimal example
above, ''if'' the exception handler gets executed then the whole process
starts over. Ideally it would start over with a newly constructed conduit,
but if we cannot prevent sharing, it would start over with the same
conduit.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12620#comment:26>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list