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

GHC ghc-devs at haskell.org
Wed Oct 3 14:48:03 UTC 2018


#12556: `stimes` adds extra power to Semigroup
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  libraries/base    |              Version:  8.0.1
      Resolution:                    |             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:                    |
-------------------------------------+-------------------------------------

Comment (by chris-martin):

 I see three options:

 1. Add a `Semigroup` law "`stimes 0 x` = ⊥". This would require
 introducing some strictness on the first argument and changing some
 (many?) instances.

 2. Add a `Semigroup` law "If `stimes 0 x` = `i` ≠ ⊥, then `i` must be an
 identity". I'd guess all of the instances already adhere to this.

 3. Add a `Semigroup` "un-law" that simply warns "For `n` less than 1,
 `stimes n x` is not defined and may produce anything." This certainly
 requires no code changes.

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


More information about the ghc-tickets mailing list