[GHC] #14837: Semigroup and Monoid instances for ST

#14837: Semigroup and Monoid instances for ST -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: feature | Status: new request | Priority: low | Milestone: Component: Compiler | Version: 8.2.2 Keywords: base | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- In `base-4.9`, a `Monoid` instance for `IO` was introduced. I would like to propose adding a similar instance for `ST`. This should be even less controversial since there is only one meaningful `Monoid` instance for `ST` (it lacks the exception-catching facilities of `IO`). The behavior of the `Semigroup` and `Monoid` instances would need to match this: {{{ instance Monoid a => Monoid (ST s a) where mappend = liftA2 mappend mempty = pure mempty }}} This would let me use `fold` and `foldMap` over `ST` computations, which would occasionally be useful. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14837 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14837: Semigroup and Monoid instances for ST -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: feature request | Status: closed Priority: low | Milestone: Component: Compiler | Version: 8.2.2 Resolution: duplicate | Keywords: base Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #14107 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => closed * resolution: => duplicate * related: => #14107 Comment: Already done in 441c52de0621ac68a2248cf691b4de31fba48a34, as it turns out, so these instances will debut in GHC 8.4.1. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14837#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14837: Semigroup and Monoid instances for ST -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: feature request | Status: closed Priority: low | Milestone: Component: Compiler | Version: 8.2.2 Resolution: duplicate | Keywords: base Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #14107 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by andrewthad): Yeah! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14837#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC