Implement andM, orM, allM, and anyM in terms of &&^ and ||^#193
Implement andM, orM, allM, and anyM in terms of &&^ and ||^#193chshersh merged 4 commits intokowainik:masterfrom
andM, orM, allM, and anyM in terms of &&^ and ||^#193Conversation
andM et al. in terms of ifMandM et al. in terms of &&^
chshersh
left a comment
There was a problem hiding this comment.
Looks like a nice code simplification and refactoring 👍 Thanks!
|
Now that these functions are written like this, I wonder if it's worth adding monadic versions of newtype AllM m = AllM (m Bool)
instance Monad m => Semigroup (AllM m) where
AllM x <> AllM y = AllM (x &&^ y)
instance Monad m => Monoid (AllM m) where
mempty = AllM (pure True)And then we could rewrite these all in terms of |
|
@josephcsible the behaviour of these functions indeed can be generalised using new
And I can add from myself that it's a bit unfortunate that |
|
Okay, I guess this can go in as-is then. By the way, what is the type |
|
@josephcsible Yeah, I mean |
andM et al. in terms of &&^andM, orM, allM, and anyM in terms of &&^ and ||^
|
CI is failing due to |
|
It passes now. |
Checklist:
HLint
hlint.dhallaccordingly to my changes (add new rules for the new imports, remove old ones, when they are outdated, etc.)..hlint.yamlfile (see this instructions).General
stylish-haskellfile.[ci skip]text to the docs-only related commit's name.