[GHC] #12556: `stimes` adds extra power to Semigroup

GHC ghc-devs at haskell.org
Wed Aug 31 17:34:35 UTC 2016


#12556: `stimes` adds extra power to Semigroup
-------------------------------------+-------------------------------------
           Reporter:  Iceland_jack   |             Owner:
               Type:  task           |            Status:  new
           Priority:  normal         |         Milestone:
          Component:                 |           Version:  8.0.1
  libraries/base                     |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Incorrect result
  Unknown/Multiple                   |  at runtime
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 {{{
 ghci> stimes 0 (undefined :: [_])
 []
 }}}
 ghci> stimes 0 undefined
 ()
 }}}

 makes it seem like `stimes 0` has some knowledge about `mempty` from
 `Monoid` but it has the following type

 {{{#!hs
 stimes 0 :: Semigroup a => a -> a
 }}}

 Desired behaviour? Given that type (assuming it only has the power of
 `<>`) I would have assumed this behaviour

 {{{
 ghci> data L a = N | C a (L a) deriving Show
 ghci> instance Semigroup (L a) where (<>) = undefined
 ghci|
 ghci> stimes 0 (undefined :: L _)
 *** Exception: stimes: positive multiplier expected
 }}}

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


More information about the ghc-tickets mailing list