[GHC] #13509: Perplexing type error

GHC ghc-devs at haskell.org
Sun Apr 2 03:30:25 UTC 2017


#13509: Perplexing type error
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.2.1
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by bgamari):

 The function in question is,
 {{{#!hs
 selectPower :: Word# -> (# Word#, Word# #)
 selectPower 2## = (# 63##, 9223372036854775808## #)
 selectPower base = go base
   where
     go :: Word# -> (# Word#, Word# #)
     go pw = case timesWord2# pw pw of
         (# 0##, pw2 #)
           -> let (# n, pw2n #) = go pw2 in
             case timesWord2# pw pw2n of
               (# 0##, pw2n1 #) -> (#n `timesWord#` 2## `plusWord#` 1##,
 pw2n1 #)
               _ -> (# n `timesWord#` 2##, pw2n #)
         _           -> (# 1##, pw #)

 }}}

 Adding a type signature, `go :: Word# -> (# Word#, Word# #)`, appears to
 allow compilation to proceed.

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


More information about the ghc-tickets mailing list