-
Notifications
You must be signed in to change notification settings - Fork 1
chore: Fix hlint action and apply changes #105
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
base: main
Are you sure you want to change the base?
Changes from all commits
e6bc1a9
2ad54b5
89a7dd5
0e0e497
f65e184
ff49857
9523683
42a8f7c
10d0a69
9591b1f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,9 @@ | ||
| name: Brat CI | ||
| on: | ||
| pull_request: [] | ||
| pull_request: | ||
| branches: [ main ] | ||
| paths: | ||
| - "**.hs" | ||
|
|
||
| jobs: | ||
| hlint: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -757,7 +757,7 @@ checkClause my fnName cty clause = modily my $ do | |
| trackM $ "[[[[[[TestMatchData\n" ++ show match ++ "\n]]]]]]" | ||
| pure (sol, match, patRo :->> outRo, fmap (Some . (patEz :*) . abstractEndz patEz) <$> defs) | ||
|
|
||
| for defs $ \((name, kind), Some (_ :* val)) -> trackM ("Def: " ++ show ((name, kind), val)) | ||
| for_ defs $ \((name, kind), Some (_ :* val)) -> trackM ("Def: " ++ show ((name, kind), val)) | ||
|
|
||
| -- Now actually make a box for the RHS and check it | ||
| ((boxPort, _ty), _) <- let ?my = my in makeBox (clauseName ++ "_rhs") rhsCty $ \(rhsOvers, rhsUnders) -> do | ||
|
|
@@ -780,7 +780,7 @@ checkClause my fnName cty clause = modily my $ do | |
| -- would arise if we've not yet defined the outer src | ||
| let vars = fst <$> sol | ||
| env <- mkEnv vars rhsOvers | ||
| (localEnv (env <> defs) $ "$rhs" -! check @m (rhs clause) ((), rhsUnders)) | ||
| localEnv (env <> defs) $ "$rhs" -! check @m (rhs clause) ((), rhsUnders) | ||
| let NamedPort {end=Ex rhsNode _} = boxPort | ||
| pure (match, rhsNode) | ||
| where | ||
|
|
@@ -804,8 +804,8 @@ checkClause my fnName cty clause = modily my $ do | |
| outPorts <- depOutPorts def | ||
| srcAndTys <- for outPorts (\outport -> (NamedPort outport "",) <$> typeOfEnd Braty (ExEnd outport)) | ||
| zx <- pure $ foldl (\sol srcAndTy -> insert ("$" ++ show (end (fst srcAndTy)), srcAndTy) sol) zx srcAndTys | ||
| (sol, defs) <- worker (zx {-:< entry-}) sol | ||
| pure ({-(patVar, (src, Left k)):-}sol, ((patVar, k), def):defs) | ||
| (sol, defs) <- worker zx sol | ||
| pure (sol, ((patVar, k), def):defs) | ||
| -- Pat vars beginning with '_' aren't in scope, we can ignore them | ||
| -- (but if they're kinded they might come up later as the dependency of something else) | ||
| worker zx (('_':_, _):sol) = worker zx sol | ||
|
|
@@ -1085,7 +1085,7 @@ kindCheckRow' :: forall m n | |
| -> Checking (Int, VEnv, Some (Endz :* Ro m n)) | ||
| kindCheckRow' _ ez env (_,i) [] = pure (i, env, Some (ez :* R0)) | ||
|
|
||
| kindCheckRow' my nys env (name, i) ((Anon ty):rest) = kindCheckRow' my nys env (name, i) ((Named (show i) ty):rest) | ||
| kindCheckRow' my nys env (name, i) ((Anon ty):rest) = kindCheckRow' my nys env (name, i) (Named (show i) ty:rest) | ||
| kindCheckRow' Braty (ny :* s) env (name,i) ((Named p (Left k)):rest) = do -- s is Stack Z n | ||
| let dangling = Ex name (ny2int ny) | ||
| req (Declare (ExEnd dangling) Braty (Left k) Definable) -- assume none are SkolemConst?? | ||
|
|
@@ -1287,6 +1287,6 @@ runChecking ve initStore ns m = do | |
| -- show multiple error locations | ||
| hs@((_,fc):_) -> Left $ Err (Just fc) (RemainingNatHopes (show . fst <$> hs)) | ||
| where | ||
| isNatKinded tyMap e = case tyMap M.! (InEnd e) of | ||
| isNatKinded tyMap e = case tyMap M.! InEnd e of | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmmm. We'll have to have precedence well engrained into our heads, then. One of Haskell's big mistakes IMHO :(
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm turning off redundant bracket checking on a per-file basis, when we have nice disambiguating brackets. It catches a lot of true positives, so I'm reticent to turn it off completely. This snippet didn't make the cut |
||
| (EndType Braty (Left Nat), _) -> True | ||
| _ -> False | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -136,7 +136,7 @@ wrapper f (Yield st k) = Yield st (wrapper f . k) | |
| wrapper f (Fork d par c) = Fork d (wrapper f par) (wrapper f c) | ||
|
|
||
| wrapper2 :: (forall a. CheckingSig a -> Maybe a) -> Checking v -> Checking v | ||
| wrapper2 f = wrapper (\s -> pure (f s)) | ||
| wrapper2 f = wrapper (pure . f) | ||
|
croyzor marked this conversation as resolved.
|
||
|
|
||
| localAlias :: (QualName, Alias) -> Checking v -> Checking v | ||
| localAlias (name, alias) = wrapper2 (\case | ||
|
|
@@ -147,7 +147,7 @@ localFC :: FC -> Checking v -> Checking v | |
| localFC f = wrapper (\case | ||
| AskFC -> pure $ Just f | ||
| (Throw e@Err{fc=Nothing}) -> req (Throw (e{fc=Just f})) >> error "Throw returned" | ||
| _ -> pure $ Nothing) | ||
| _ -> pure Nothing) | ||
|
croyzor marked this conversation as resolved.
|
||
|
|
||
| localEnv :: (?my :: Modey m) => Env (EnvData m) -> Checking v -> Checking v | ||
| localEnv = case ?my of | ||
|
|
@@ -172,7 +172,7 @@ captureOuterLocals n c = do | |
| where | ||
| helper :: VEnv -> forall a. CheckingSig a -> Checking (Maybe a) | ||
| helper avail (VLup x) | j@(Just new) <- M.lookup x avail = | ||
| (req $ AddCapture n (x,new)) >> (pure $ Just j) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It dislikes
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only when it means we can get rid of the outer brackets |
||
| req (AddCapture n (x,new)) >> pure (Just j) | ||
| helper _ _ = pure Nothing | ||
|
|
||
| wrapError :: (Error -> Error) -> Checking v -> Checking v | ||
|
|
@@ -272,7 +272,7 @@ handler (Req s k) ctx | |
| AskNS -> error "AskNS in handler, should only happen under `-!`" | ||
| Throw err -> Left err | ||
| LogHole hole -> do (v,ctx,holes) <- handler (k ()) ctx | ||
| return (v,ctx,(hole:holes)) | ||
| return (v,ctx,hole:holes) | ||
| AskFC -> error "AskFC in handler - shouldn't happen, should always be in localFC" | ||
| VLup s -> handler (k $ M.lookup s (globalVEnv ctx)) ctx | ||
| ALup s -> handler (k $ M.lookup s (aliasTable ctx)) ctx | ||
|
|
@@ -350,7 +350,7 @@ handler (Define lbl end v k) ctx = let st@Store{typeMap=tm, valueMap=vm} = store | |
| InEnd inport -> case M.lookup inport (dynamicSet ctx) of | ||
| Just fc -> track ("Replace " ++ show end ++ " with " ++ show newDynamics) $ | ||
| M.union | ||
| (M.fromList (zip newDynamics (repeat fc))) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly, I'm not sure I see this as an improvement
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is good, zip is dangerous to begin with; it's nicer to use one thing many times than make an infinite list of it and pull from that |
||
| (M.fromList (map (, fc) newDynamics)) | ||
| (M.delete inport (dynamicSet ctx)) | ||
| Nothing -> dynamicSet ctx | ||
| }) | ||
|
|
||
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.
I wonder if brackets around
localEnv (env <> defs> $ "$rhs"would be allowed to make precedence more explicitThere 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.
That would be wrong! It should be
localEnv (env <> defs) ("rhs" -! ...)