mirror of
https://github.com/github/semantic.git
synced 2024-12-26 16:33:03 +03:00
5.9 KiB
5.9 KiB
Development Guide
semantic
is built using the stack
build system and the ghc compiler. It’s packaged using Cabal, and uses dependencies from Hackage.
Tool | Explanation |
---|---|
ghc |
The Glasgow Haskell Compiler is the open source compiler and interactive environment for the Haskell programming language. |
cabal |
Cabal is a system for building and packaging Haskell libraries and programs. It is similar to having make files instead of having to type several complicated calls to ghc to compile and link a project. |
stack |
Stack is used to develop Haskell projects. It is a layer on top of cabal and ghc that aims to make it much easier to build cross-platform Haskell projects. It lets us use different versions of ghc and has snapshots of packages that are known to work together. It defers to cabal for much of its work. Historically, we used cabal directly, but ran into a variety of tooling issues that brought us back to stack. Officially, stack uses stackage as its package archive, and cabal-install uses hackage. |
hackage |
Hackage is the most widely used package archive of open source libraries and programs. cabal-install is used to download and install packages. |
ghci |
ghci is GHC's interactive environment. This is where Haskell expressions can be interactively evaluated and programs can be interpreted. |
Running a REPL
Running stack ghci semantic
will boot a GHCi with the right environment for Semantic set up.
See the 💡ProTips for more info.
Configuring Atom
You may want to customize Atom to support your haskelling:
- Install Haskell-specific packages:
language-haskell
provides syntax highlighting for.hs
,.cabal
, and other Haskell files.stylish-haskell
can be used viaatom-beautify
for source code formatting.align-regexp
is convenient for aligning blocks of text by some pattern.- Either
ide-haskell-hie
oride-haskell
:ide-haskell-hie
usesatom-ide-ui
andhaskell-ide-engine
(instructions below) to provide linting, errors, warnings, types on hover, autocompletion, etc.git clone https://github.com/haskell/haskell-ide-engine.git
somewhere convenient andcd
into it.- Run
make
to build and installghc
-specific versions ofhie
into~/.local/bin
. This will allow you to usehie
with projects using different versions ofghc
(currently 8.0.2, 8.2.1, and 8.2.2). Alternatively,stack install
will build with the current supported version ofghc
(8.2.2 at time of writing) and copy it to~/.local/bin/hie
. - Make sure that
~/.local/bin/
is on yourPATH
. - If you went with the
ghc
-specific install route (make
), then configureide-haskell-hie
to “Use the hie-wrapper”: .
ide-haskell
also provides errors, warnings, types, etc. usingghc-mod
and other tools:stack install ghc-mod hlint happy
— this installsghc-mod
andhlint
executables on your system required for thehaskell-ghc-mod
Atom package below.- Install
haskell-ghc-mod
, andide-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 toAtom -> Preferences -> Packages -> haskell-ghc-mod -> Settings
and editing "Additional Paths": autocomplete-haskell
: Autocompletionide-haskell-hasktags
: Symbols
- Install a font with ligatures (this will require per-font configuration):
- Find Documentation
- For the most part our dependencies have documentation on hackage. You can find individual packages there.
- Hayoo and Hoogle can search package documentation on hackage by package name, symbol name, and even symbol type.
- Dash can install documentation from hackage, search by API, and integrations exist for Atom, emacs, and other tools.
💡ProTip!
See 💡ProTip!.md for more.