New module: Control.Rematch.Data, for data type generic matchers#11
Open
jh3141 wants to merge 1 commit intotom-pang:masterfrom
Open
New module: Control.Rematch.Data, for data type generic matchers#11jh3141 wants to merge 1 commit intotom-pang:masterfrom
jh3141 wants to merge 1 commit intotom-pang:masterfrom
Conversation
using the Data.Data.Data typeclass, isDataConstr and isDataValue
Author
|
Note - the CI build failure is apparently caused by a version conflict between rematch-quickcheck (which wants |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
using the Data.Data.Data typeclass, isDataConstr and isDataValue
Examples:
`import Data.Data
import Contorl.Rematch
import Control.Rematch.Data
data MyStructure = First | Second Int | Third Bool String deriving (Data)
myTests = [runMatch (isDataConstr Second) First,
runMatch (isDataConstr Second) $ Second 4,
runMatch (isDataValue Second 0 $ equalTo 10) $ Second 10,
runMatch (isDataValue Third 1 $ equalTo "Hello") $ Third False "Goodbye"]`
(with obviously the second and third matchers succeeding while the others fail)
I've isolated this pull request from my others, but this does mean some (relatively trivial) merging work would be required to accept all of them. If you decide to do so, it may be easier to directly pull my changes from my fork's master rather than merge them manually.