Closed patrickt closed 5 years ago
This looks good, but can we address those failures with older GHCs on travis? For example,
src/Data/Machine/Moore.hs:164:13: error:
• Could not deduce (Semigroup b) arising from a use of ‘<>’
from the context: Monoid b
bound by the instance declaration
at src/Data/Machine/Moore.hs:162:10-39
Possible fix:
add (Semigroup b) to the context of the instance declaration
• In the expression: (<>)
In an equation for ‘mappend’: mappend = (<>)
In the instance declaration for ‘Monoid (Moore a b)’
|
164 | mappend = (<>)
| ^^^^
@acowley Sorry about that; should be fixed now.
LGTM; thanks for taking care of this. Hopefully @RyanGlScott or @YoEight can take a last look and merge it soon.
I’ve run into a snag when testing with GHC 8.2.2, which supports the -Wnoncanonical-monoid-instances
warning, but does not have a base
with the Semigroup/Monoid proposal applied. In this case, it appears not to be possible to suppress this warning without introducing unforced backcompat errors (/hattip @treeowl for pointing that out).
It’s probably just worth scrapping this PR, since this isn’t an error that most people find.
When compiling with
-Wall
, GHC warns if aMonoid
instance definesmappend
as something other than an alias for<>
. TheMonoid
instances for Moore and Mealy machines defined their ownmappend
implementations, though they did not differ semantically from<>
.This replaces those
mappend
definitions with<>
.