-
Notifications
You must be signed in to change notification settings - Fork 458
Conversation
@@ -23,7 +23,7 @@ | |||
- warn: {group: {name: default}} | |||
|
|||
# Ignore the highly noisy module export list hint | |||
- ignore: {name: Use module export list} | |||
- ignore: {name: Use explicit module export list} |
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 one apparently changed.
@@ -1,7 +1,7 @@ | |||
# HLint configuration file | |||
# https://github.com/ndmitchell/hlint | |||
|
|||
- arguments: [--color=auto, -XDataKinds, -XDeriveFoldable, -XDeriveFunctor, -XDeriveGeneric, -XDeriveTraversable, -XFlexibleContexts, -XFlexibleInstances, -XMultiParamTypeClasses, -XOverloadedStrings, -XRecordWildCards, -XStandaloneDeriving, -XStrictData, -XTypeApplications, -XDerivingVia] | |||
- arguments: [--color=auto, -XStrictData] |
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.
yay!
import Algebra.Graph | ||
import Control.Monad |
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.
Did you know we didn’t have warnings enabled in the benchmarks?
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.
😮
default-extensions: DataKinds | ||
, DeriveFoldable | ||
, DeriveFunctor | ||
, DeriveGeneric | ||
, DeriveTraversable | ||
, FlexibleContexts | ||
, FlexibleInstances | ||
, MonadFailDesugaring | ||
, MultiParamTypeClasses | ||
, OverloadedStrings | ||
, RecordWildCards | ||
, StandaloneDeriving | ||
, StrictData | ||
, TypeApplications |
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.
All of these have been moved to the .hs
files, except StrictData
, which does not affect parsing/typechecking, and MonadFailDesugaring
, which is obsolete in 8.6+.
, TypeApplications | ||
default-extensions: StrictData | ||
ghc-options: | ||
-Weverything |
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.
Hard mode.
@@ -1,4 +1,4 @@ | |||
{-# LANGUAGE GeneralizedNewtypeDeriving, TypeOperators #-} | |||
{-# LANGUAGE DeriveFunctor, FlexibleContexts, GeneralizedNewtypeDeriving, TypeApplications, TypeOperators #-} |
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.
A lot of these FlexibleContexts
additions are going to go away with fused-effects
1.0.
vertexAttributes UnknownModule{} = [ "style" := "dotted, rounded", "shape" := "box", "color" := "red", "fontcolor" := "red" ] | ||
vertexAttributes (Variable n _ s) = [ "label" := T.encodeUtf8Builder (n <> " (Variable)"), "tooltip" := T.encodeUtf8Builder (showSpan s), "style" := "rounded", "shape" := "box" ] | ||
vertexAttributes (Method n _ s) = [ "label" := T.encodeUtf8Builder (n <> " (Method)"), "tooltip" := T.encodeUtf8Builder (showSpan s) , "style" := "rounded", "shape" := "box" ] | ||
vertexAttributes (Function n _ s) = [ "label" := T.encodeUtf8Builder (n <> " (Function)"), "tooltip" := T.encodeUtf8Builder (showSpan s), "style" := "rounded", "shape" := "box" ] |
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.
Fallout from the changes to ControlFlowVertex
.
@@ -15,7 +15,7 @@ import Prologue | |||
import Source.Loc | |||
|
|||
newtype PackageDef = PackageDef { moduleDefIdentifier :: T.Text } | |||
deriving (Eq, Generic, Show) | |||
deriving (Eq, Show) |
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 also took the opportunity to 🔥 a few Generic
instances we weren’t using.
-- | Match a branch node, matching its children with the supplied 'Assignment' & returning the result. | ||
branchNode :: (Enum grammar, Ix grammar) => grammar -> Assignment ast grammar a -> Assignment ast grammar a | ||
branchNode sym child = symbol sym *> children child | ||
|
||
-- | Match a leaf node, returning the corresponding 'Text'. | ||
leafNode :: (Enum grammar, Ix grammar) => grammar -> Assignment ast grammar Text | ||
leafNode sym = symbol sym *> source | ||
|
||
-- | Wrap an 'Assignment' producing @syntax@ up into an 'Assignment' producing 'Term's. | ||
toTerm :: Element syntax syntaxes | ||
=> Assignment ast grammar (syntax (Term (Sum syntaxes) L.Loc)) | ||
-> Assignment ast grammar (Term (Sum syntaxes) L.Loc) | ||
toTerm syntax = termIn <$> location <*> (inject <$> syntax) |
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.
These were unused.
unLoopControl :: LoopControl value -> value | ||
unLoopControl = \case | ||
Break v -> v | ||
Continue v -> v | ||
Abort -> error "unLoopControl: Abort" |
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.
Silencing partial selector warnings.
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.
A couple questions, but this is a major improvement. The default-extensions
field is a prime example of false economy, I think, so kudos for ditching it (even if we are married to StrictData
).
import Algebra.Graph | ||
import Control.Monad |
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.
😮
@@ -361,20 +342,18 @@ instance (Enum grammar, Eq1 ast, Ix grammar, Show grammar) => Parsing (Assignmen | |||
(<?>) :: HasCallStack => Assignment ast grammar a -> String -> Assignment ast grammar a | |||
a <?> s = tracing (Label a s) `Then` pure | |||
|
|||
unexpected :: HasCallStack => String -> Assignment ast grammar a | |||
unexpected :: String -> Assignment ast grammar a |
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.
Thought: instead of just ditching this constraint, can we glom it on to the passed String
? I feel like call stacks are good and we shouldn’t lose these constraints, but maybe I’m bugging.
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’ve only removed redundant constraints. This call stack was never used, so we haven’t lost anything.
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.
Fair enough. I guess it would still be preserved if we called error
here? But we don’t, so no matter.
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.
Yes, it wouldn’t have been redundant in that case, and I wouldn’t have removed it 😁
@@ -133,17 +133,18 @@ data Function term address value (m :: * -> *) k | |||
| BuiltIn address BuiltIn (value -> m k) -- ^ A built-in is parameterized by its parent scope, BuiltIn type, and returns a value. | |||
| Call value [value] (value -> m k) -- ^ A Call takes a set of values as parameters and returns a ValueRef. | |||
| Bind value value (value -> m k) | |||
deriving stock (Functor, Generic1) | |||
deriving anyclass (HFunctor, Effect) |
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.
my beautiful deriving strategies nooooo
(just kidding this is fine)
This PR makes
semantic
play a little more nicely withghcide
, especially when configuring it to load all of the components.It does this by:
Eliminating the project-wide language extensions in favour of per-file ones. Given the choice between enabling these globally for all of our packages and configuring
ghcide
to do the same or enabling them on a file-by-file basis, I strongly prefer to enable them file-by-file, as it makes reasoning locally about what’s going on in the file much easier. (Note that this also makes integration with tools such ashlint
easier.)Enabling more warnings across
semantic
(and fixing them). Unlike language extensions which are usually conveniences, these are generally very good ideas to have globally enabled.I’m not quite ready to commit a
hie.yaml
file because at the present time these require absolute paths to the source directories when used with VS Code, but it is also possible to write a script to provide these, and that should be simple enough for us to integrate in a follow-up PR.