[GHC] #15226: GHC doesn't know that seq# produces something in WHNF

GHC ghc-devs at haskell.org
Thu Jun 7 08:01:49 UTC 2018


#15226: GHC doesn't know that seq# produces something in WHNF
-------------------------------------+-------------------------------------
        Reporter:  dfeuer            |                Owner:  (none)
            Type:  bug               |               Status:  merge
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.4.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D4796
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Good point. A cast would complicate.   I suppose that in
 {{{
 case seq# x s |> g of
   (# s', x' #) -> ...
 }}}
 we'd have to have
 {{{
  g :: (# State# t1, t2 #) ~ (# s1, s2 #)
 }}}
 where `x :: t2` and `x' :: s2`.  So you'd want to transform to
 {{{
 case seq# x s |> g of
   (# s', x' #) -> let x = x' |> sym (Nth 2 g)
 }}}
 because `Nth 2 g :: t2 ~ s2`.  (I might not have this exactly right.)

 This all seems a bit ad-hoc for `seq#` but I don't really see an
 alternative, sadly.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15226#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list