-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[refactor] combine checkInputs/Outputs and use for(M) #42
Conversation
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be better called zipSuffixes
or zipWithSuffixes
, though
There were two goals here:
Bool
flag tocheckWire
) and the error messageforM
over them - this should make it nice and easy to useFork
in 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)