[refactor] combine checkInputs/Outputs and use for(M)#42
Merged
Conversation
acl-cqc
commented
Oct 21, 2024
acl-cqc
commented
Oct 21, 2024
| extractSuffixes [] bs = ([], Left $ TypeErr $ errMsg ++ showRow bs ++ " for " ++ show tm) | ||
| extractSuffixes (a:as) (b:bs) = first ((a:|as,b:|bs):) $ extractSuffixes as bs | ||
|
|
||
| checkInputs :: forall m d . (CheckConstraints m KVerb, ?my :: Modey m) |
Collaborator
Author
There was a problem hiding this comment.
Of course if we got rid of the extensive existing type signatures for checkInputs and checkOutputs then the line count here would look much better ;-). (Each of checkInputs and checkOutputs is used twice though so I don't think inlining is a good idea)
acl-cqc
commented
Oct 21, 2024
brat/Brat/Checker.hs
Outdated
| addRowContext exp act = \case | ||
| (Err fc (TypeMismatch tm _ _)) -> Err fc $ TypeMismatch tm exp act | ||
| e -> e | ||
| extractSuffixes as [] = ([], Right as) |
Collaborator
Author
There was a problem hiding this comment.
Type signature here is
[(NamedPort exp, BinderType m)]
-> [(NamedPort act, BinderType m)]
-> ([(NonEmpty (NamedPort exp, BinderType m), NonEmpty (NamedPort act, BinderType m))]
, Either Error [(NamedPort exp, BinderType m)]
)
if you really want it (!)...perhaps with a type TypedPort e m = (NamedPort e, BinderType m) ??
Collaborator
Author
There was a problem hiding this comment.
This might be better called zipSuffixes or zipWithSuffixes, though
croyzor
approved these changes
Oct 30, 2024
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.
There were two goals here:
Boolflag tocheckWire) and the error messageforMover them - this should make it nice and easy to useForkin Multi-threaded type inference #41Felt I jumped through a few hoops to preserve behaviour, but maybe that's worth it, specifically I liked doing the do-the-wires-match-types before the "is there anything leftover" check.
Individual commits should all compile if you want to look at some intermediates (these may be plausible endpoints)