Skip to content
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

Spelling #724

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion .licenses/semantic/cabal/cmark-gfm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ SOFTWARE.

buffer.h, buffer.c, chunk.h

are derived from code (C) 2012 Github, Inc.
are derived from code (C) 2012 GitHub, Inc.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brand...


Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
4 changes: 2 additions & 2 deletions .licenses/semantic/cabal/terminfo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

- Redistribution of source code must retain the above copyright notice,
this list of conditions and the following disclamer.
this list of conditions and the following disclaimer.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lawyers tend to get annoyed by changes to licenses/copyright notices, but...


- Redistribution in binary form must reproduce the above copyright notice,
this list of conditions and the following disclamer in the documentation
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY
Expand Down
2 changes: 1 addition & 1 deletion .licenses/semantic/cabal/time-locale-compat.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
type: cabal
name: time-locale-compat
version: 0.1.1.5
summary: Compatibile module for time-format locale
summary: Compatible module for time-format locale
homepage: https://github.com/khibino/haskell-time-locale-compat
license: bsd-3-clause
---
Expand Down
2 changes: 1 addition & 1 deletion docs/coding-style.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Haskell is a syntactically-flexible language, which gives the programmer a tremendous amount of leeway regarding the appearance of their code. This is a set of best practices that we use in `semantic` and its related projects.

This file draws from the style guides written by [Johan Tibbel](https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md) and [Kowainik](https://kowainik.github.io/posts/2019-02-06-style-guide).
This file draws from the style guides written by [Johan Tibell](https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md) and [Kowainik](https://kowainik.github.io/posts/2019-02-06-style-guide).
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


# General guidelines

Expand Down
2 changes: 1 addition & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ You may want to customize Atom to support your haskelling:
- [`ide-haskell`](https://atom.io/packages/ide-haskell) also provides errors, warnings, types, etc. using `ghc-mod` and other tools:
- `stack install ghc-mod hlint happy` — this installs `ghc-mod` and `hlint` executables on your system required for the `haskell-ghc-mod` Atom package below.
- Install [`haskell-ghc-mod`](https://atom.io/packages/haskell-ghc-mod), and [`ide-haskell-cabal`](https://atom.io/packages/ide-haskell-cabal)
- If you don't launch Atom from your shell, set the additional paths for the the `haskell-ghc-mod` package in Atom to include `/Users/$USER/.local/bin/` and `/usr/local/bin`. This is done by going to `Atom -> Preferences -> Packages -> haskell-ghc-mod -> Settings` and editing "Additional Paths":
- If you don't launch Atom from your shell, set the additional paths for the `haskell-ghc-mod` package in Atom to include `/Users/$USER/.local/bin/` and `/usr/local/bin`. This is done by going to `Atom -> Preferences -> Packages -> haskell-ghc-mod -> Settings` and editing "Additional Paths":
![image](https://user-images.githubusercontent.com/875834/31060015-5ff171b0-a6c0-11e7-9f44-65ff776cd9a2.png)
- [`autocomplete-haskell`](https://atom.io/packages/autocomplete-haskell): Autocompletion
- [`ide-haskell-hasktags`](https://atom.io/packages/ide-haskell-hasktags): Symbols
Expand Down
4 changes: 2 additions & 2 deletions docs/grammar-development-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Here are some guidelines to determine what approach to take when removing superf

2. **Add it to the inline array.** If the rule is used more than once and its definition is not simple, make it `inline`. If this does not cause parsing problems, this is the best approach, because it will avoid intermediate node allocations and parsing operations at runtime. One possible side-effect of `inline` is that is sometimes makes the parser much larger in terms of number of states. To evaluate whether this has happened, it’s worth looking at the `STATE_COUNT` in `parser.c` before and after. If the state count goes way up, it may not be worth adding the rule to `inline` since more states mean more one-time memory footprint for the parser. If it goes up a few percent (or goes down), it’s fine to add.

3. **Mark it hidden.** If `inline` causes conflicts or drastically increases the size of the parse table, it's better to mark it as hidden. This is often useful when two nodes can not exist without one another. For example, `class_body_declaration` was a child of `class_body` and occurred together 100% of the time. Similarly, `type_arguments` can not exist independent of its child node, `type_argument`. In both cases, it makes sense to hide the former.
3. **Mark it hidden.** If `inline` causes conflicts or drastically increases the size of the parse table, it's better to mark it as hidden. This is often useful when two nodes cannot exist without one another. For example, `class_body_declaration` was a child of `class_body` and occurred together 100% of the time. Similarly, `type_arguments` cannot exist independent of its child node, `type_argument`. In both cases, it makes sense to hide the former.
```diff
(generic_type
(type_identifier)
Expand All @@ -138,7 +138,7 @@ Most languages have a long-tail of features that are not frequently utilized in

### Handling conflicts

Conflicts may arise due to ambiguities in the grammar. This is when the parser can not decide what the next symbol in an input stream should be because there are multiple ways to parse some strings.
Conflicts may arise due to ambiguities in the grammar. This is when the parser cannot decide what the next symbol in an input stream should be because there are multiple ways to parse some strings.

- **Refactor by removing duplication.** Take two rules that parse the same string and combine them into a single rule that gets used in two places. Simplifying the number of rules reduces the search space of possible paths the parser can pursue, and resultantly can resolve to a single rule more easily.

Expand Down
2 changes: 1 addition & 1 deletion docs/why-haskell.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Haskell is a pleasure to work in everyday. It's both productive and eye-opening.

- *Editor tooling* is sub-par (especially compared to language communities like Java and C#) and finicky - we often end up just compiling in a separate terminal.
- *Edges of the type system*. We often find ourselves working at the edges of Haskell's incredible type system, wishing for dependent types or reaching for complex workarounds like the [Advanced Overlap][] techniques designed by Oleg Kiselyov & Simon Peyton Jones.
- *Infra glue*. Haskell is very competent at standard infrastructure functionality like running a webserver, but it isn't the focus of the language community so you're often left writing your own libraries and components when you need to plug in to modern infrastructure.
- *Infra glue*. Haskell is very competent at standard infrastructure functionality like running a webserver, but it isn't the focus of the language community so you're often left writing your own libraries and components when you need to plug into modern infrastructure.
- *Lazy evaluation* isn't always what you want and can have performance problems and make some debugging activities incredibly frustrating. We use the `StrictData` language extension to combat some of these difficulties.
- *Haskell has a reputation for being difficult to learn.* Some of that is well deserved, but half of it has more to do with how many of us first learned imperative programming and the switch to a functional paradigm takes some patience. Haskell also leverages a much more mathematically rigorous set of abstractions which likely aren't as familiar to web developers. We have, however, had very good luck on-boarding new team members with a wide range of previous experience and the quality of learning Haskell resources has really improved.

Expand Down
2 changes: 1 addition & 1 deletion script/protoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PARENT_DIR=$(dirname $(pwd))
export PROJECT="github.com/github/semantic"

# Generate Haskell for semantic's protobuf types. See the entrypoint in
# Dockerfile for where the protoc pluggins are configured.
# Dockerfile for where the protoc plugins are configured.
docker run --rm --user $(id -u):$(id -g) -v $(pwd):/go/src/$PROJECT -w /go/src/$PROJECT \
semantic-protoc --proto_path=proto \
--haskell_out=./semantic-proto/src \
Expand Down
2 changes: 1 addition & 1 deletion semantic-analysis/.ghci.repl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
:set -fwrite-interface -fobject-code

-- Disable breaking on error since it hangs on uncaught exceptions when the sandbox is disabled: https://gitlab.haskell.org/ghc/ghc/issues/17743
-- This was already disabled in .ghci, but it turns out that if your user-wide .ghci file sets -fbreak-on-error, it gets overriden, so we override it back again here.
-- This was already disabled in .ghci, but it turns out that if your user-wide .ghci file sets -fbreak-on-error, it gets overridden, so we override it back again here.
:set -fno-break-on-error

-- Bonus: silence “add these modules to your .cabal file” warnings for files we :load
Expand Down
2 changes: 1 addition & 1 deletion semantic-ast/src/AST/Element.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Element' (side :: Side) sub sup where
instance Element' 'Here t t where
prj' = Just

-- | Membershp on the left.
-- | Membership on the left.
instance Element t l
=> Element' 'L t (l :+: r) where
prj' (L1 l) = prj l
Expand Down
2 changes: 1 addition & 1 deletion semantic-java/src/Language/Java/AST.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1791,7 +1791,7 @@ instance Data.Traversable.Traversable ConstructorBody where
data ConstructorDeclaration a = ConstructorDeclaration
{ ann :: a,
body :: (AST.Parse.Err (ConstructorBody a)),
typeParamaters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))),
typeParameters :: (GHC.Maybe.Maybe (AST.Parse.Err (TypeParameters a))),
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scary?

name :: (AST.Parse.Err (Identifier a)),
parameters :: (AST.Parse.Err (FormalParameters a)),
extraChildren :: ([AST.Parse.Err ((Modifiers GHC.Generics.:+: Throws) a)])
Expand Down
2 changes: 1 addition & 1 deletion semantic-python/src/Language/Python/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ instance Compile Py.Attribute
-- @
-- (b :<- c) >>>= (a :<- b) >>>= cont
-- @
-- The tree structure that we get out of tree-sitter is not particulary conducive to expressing
-- The tree structure that we get out of tree-sitter is not particularly conducive to expressing
-- this naturally, so we engage in a small desugaring step so that we can turn a list [a, b, c]
-- into a sequenced Core expression using >>>= and a fold through which information—specifically
-- the LHS to assign—flows.
Expand Down
2 changes: 1 addition & 1 deletion semantic-tags/src/Tags/Tag.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Data.Text (Text)
import qualified Proto.Semantic as P
import Source.Loc

-- | A 0-indxed Span where the column offset units are utf-16 code units (2
-- | A 0-indexed Span where the column offset units are utf-16 code units (2
-- bytes), suitable for the LSP (Language Server Protocol) specification.
newtype UTF16CodeUnitSpan = UTF16CodeUnitSpan { unUTF16CodeUnitSpan :: Span }
deriving (Eq, Show)
Expand Down
2 changes: 1 addition & 1 deletion semantic-tags/test/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ testTree = Tasty.testGroup "Tags.Tagging.Precise"

-- NB: This emoji (:man-woman-girl-girl:) cannot be entered into a string literal in haskell for some reason, you'll get:
-- > lexical error in string/character literal at character '\8205'
-- The work around is to enter the unicode directly (7 code points).
-- The workaround is to enter the unicode directly (7 code points).
-- utf-8: 25 bytes to represent
-- utf-16: 23 bytes to represent
, testCase "multi code point unicode :man-woman-girl-girl:" $
Expand Down
2 changes: 1 addition & 1 deletion semantic/src/Parsing/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ data Parser term where
-- $abstract
-- Most of our features are intended to operate over multiple languages, each represented by disjoint term types. Thus, we typically implement them using typeclasses, allowing us to share a single interface to invoke the feature, while specializing the implementation(s) as appropriate for each distinct term type.
--
-- In order to accomplish this, we employ 'SomeParser', which abstracts over parsers of various term types, while ensuring that some desired constraint holds. Constructing a @'SomeParser' c@ requires satisfiyng the constraint @c@ against the underlying 'Parser'’s term type, and so it can be used to parse with any of a map of parsers whose terms support @c@.
-- In order to accomplish this, we employ 'SomeParser', which abstracts over parsers of various term types, while ensuring that some desired constraint holds. Constructing a @'SomeParser' c@ requires satisfying the constraint @c@ against the underlying 'Parser'’s term type, and so it can be used to parse with any of a map of parsers whose terms support @c@.
--
-- In practice, this means using 'Control.Effect.Parse.parseWith', and passing in a map of parsers to select from for your feature. It is recommended to define the map as a concrete top-level binding using the abstract parsers or ideally the canonical maps of parsers, below; using the abstracted parsers or canonical maps directly with 'Control.Effect.Parse.parseWith' will lead to significantly slower compiles.
--
Expand Down
12 changes: 6 additions & 6 deletions semantic/src/Semantic/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ data Config
, configTreeSitterParseTimeout :: Duration -- ^ Timeout in milliseconds before canceling tree-sitter parsing (default: 6000).
, configTreeSitterUnmarshalTimeout :: Duration -- ^ Timeout in milliseconds before canceling tree-sitter unmarshalling (default: 4000).
, configAssignmentTimeout :: Duration -- ^ Millisecond timeout for assignment (default: 4000)
, configMaxTelemetyQueueSize :: Int -- ^ Max size of telemetry queues before messages are dropped (default: 1000).
, configIsTerminal :: Flag IsTerminal -- ^ Whether a terminal is attached (set automaticaly at runtime).
, configMaxTelemetryQueueSize :: Int -- ^ Max size of telemetry queues before messages are dropped (default: 1000).
, configIsTerminal :: Flag IsTerminal -- ^ Whether a terminal is attached (set automatically at runtime).
, configLogPrintSource :: Flag LogPrintSource -- ^ Whether to print the source reference when logging errors (set automatically at runtime).
, configLogFormatter :: LogFormatter -- ^ Log formatter to use (set automatically at runtime).
, configSHA :: String -- ^ SHA to include in log messages (set automatically).
Expand Down Expand Up @@ -98,7 +98,7 @@ defaultConfig options = do
, configTreeSitterParseTimeout = fromMilliseconds parseTimeout
, configTreeSitterUnmarshalTimeout = fromMilliseconds unmarshalTimeout
, configAssignmentTimeout = fromMilliseconds assignTimeout
, configMaxTelemetyQueueSize = size
, configMaxTelemetryQueueSize = size
, configIsTerminal = flag IsTerminal isTerminal
, configLogPrintSource = flag LogPrintSource isTerminal
, configLogFormatter = if isTerminal then terminalFormatter else logfmtFormatter
Expand Down Expand Up @@ -131,16 +131,16 @@ logOptionsFromConfig Config{..} = LogOptions


withLoggerFromConfig :: Config -> (LogQueue -> IO c) -> IO c
withLoggerFromConfig config = withLogger (logOptionsFromConfig config) (configMaxTelemetyQueueSize config)
withLoggerFromConfig config = withLogger (logOptionsFromConfig config) (configMaxTelemetryQueueSize config)


withErrorReporterFromConfig :: Config -> Error.ErrorLogger -> (ErrorQueue -> IO c) -> IO c
withErrorReporterFromConfig Config{..} errorLogger =
withErrorReporter (nullErrorReporter errorLogger) configMaxTelemetyQueueSize
withErrorReporter (nullErrorReporter errorLogger) configMaxTelemetryQueueSize

withStatterFromConfig :: Config -> (StatQueue -> IO c) -> IO c
withStatterFromConfig Config{..} =
withStatter configStatsHost configStatsPort configAppName configMaxTelemetyQueueSize
withStatter configStatsHost configStatsPort configAppName configMaxTelemetryQueueSize

lookupStatsAddr :: IO (Stat.Host, Stat.Port)
lookupStatsAddr = do
Expand Down