[GHC] #13977: ExnStr doesn't propagate "outwards"
GHC
ghc-devs at haskell.org
Tue Jul 18 15:09:27 UTC 2017
#13977: ExnStr doesn't propagate "outwards"
-------------------------------------+-------------------------------------
Reporter: bgamari | Owner: (none)
Type: bug | 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: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Description changed by bgamari:
Old description:
> While looking into #8091 (see ticket:8091#comment:9) and #13916, I
> noticed something that I found rather surprising. Consider this program,
>
> {{{#!hs
> hello :: STR Char -> STM Char
> hello a = a `orElse` pure 'a'
> }}}
>
> Recall that `catchRetry#` (which `orElse` is defined in terms of) has the
> following demand signature,
> {{{
> <xC(S),1*C1(U)><L,1*C1(U)><L,U>
> }}}
> Note the `x` here: this means it is `ExnStr`, since it doesn't bottom
> even if the first argument does (despite the fact that it's strict).
>
> So, the question is this: What demand should `hello` place on its first
> argument? I would have thought that it should be precisely the same as
> the demand that `catchRetry#` places on **its** first argument. However,
> the demand analyser seems to conclude this:
> {{{
> <C(S),1*C1(U)>
> }}}
>
> Note the lack of an `x`. I believe this may be what causes #13916.
New description:
While looking into #8091 (see ticket:8091#comment:9) and #13916, I noticed
something that I found rather surprising. Consider this program,
{{{#!hs
hello :: STM Char -> STM Char
hello a = a `orElse` pure 'a'
}}}
Recall that `catchRetry#` (which `orElse` is defined in terms of) has the
following demand signature,
{{{
<xC(S),1*C1(U)><L,1*C1(U)><L,U>
}}}
Note the `x` here: this means it is `ExnStr`, since it doesn't bottom even
if the first argument does (despite the fact that it's strict).
So, the question is this: What demand should `hello` place on its first
argument? I would have thought that it should be precisely the same as the
demand that `catchRetry#` places on **its** first argument. However, the
demand analyser seems to conclude this:
{{{
<C(S),1*C1(U)>
}}}
Note the lack of an `x`. I believe this may be what causes #13916.
--
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13977#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list