[GHC] #12779: isTrue# doesn't work in ghci anymore

GHC ghc-devs at haskell.org
Sat Oct 29 00:07:47 UTC 2016


#12779: isTrue# doesn't work in ghci anymore
-------------------------------------+-------------------------------------
        Reporter:  osa1              |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  GHCi              |              Version:  8.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #12718            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by osa1):

 Documentation of `isTrue#` agrees with that:

 {{{#!haskell
 {-# INLINE isTrue# #-}
 -- | Alias for 'tagToEnum#'. Returns True if its parameter is 1# and False
 --   if it is 0#.
 isTrue# :: Int# -> Bool   -- See Note [Optimizing isTrue#]
 isTrue# x = tagToEnum# x
 }}}

 but there's also this in the same file:

 {{{#!haskell
 {- Note [Optimizing isTrue#]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Current definition of isTrue# is a temporary workaround. We would like to
 have functions isTrue# and isFalse# defined like this:

     isTrue# :: Int# -> Bool
     isTrue# 1# = True
     isTrue# _  = False

     isFalse# :: Int# -> Bool
     isFalse# 0# = True
     isFalse# _  = False
 }}}

 So I'm not sure what's the correct behavior here. Would raising a panic be
 too costly here?

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


More information about the ghc-tickets mailing list