-
Notifications
You must be signed in to change notification settings - Fork 453
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #373 from github/multi-component-repl
Multi component repl
- Loading branch information
Showing
6 changed files
with
139 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
-- Consider copying this to your ~/.ghc/ghci.conf file: | ||
|
||
-- Pretty-printing | ||
:set -ignore-package pretty-simple -package pretty-simple | ||
:def! pretty \ _ -> pure ":set -interactive-print Text.Pretty.Simple.pPrint" | ||
:def! no-pretty \ _ -> pure ":set -interactive-print System.IO.print" | ||
:def! r \_ -> pure ":reload\n:pretty" | ||
|
||
-- Turn on some language extensions you use a lot | ||
:seti -XFlexibleContexts -XOverloadedStrings -XTypeApplications | ||
|
||
-- Break on errors | ||
:seti -fbreak-on-error | ||
|
||
-- Automatically show the code around breakpoints | ||
:set stop :list | ||
|
||
-- Use a cyan lambda as the prompt | ||
:set prompt "\ESC[1;36m\STXλ \ESC[m\STX" | ||
|
||
-- Better errors | ||
:set -ferror-spans -freverse-errors -fprint-expanded-synonyms | ||
|
||
-- Path-local ghci history | ||
:set -flocal-ghci-history | ||
|
||
-- Better typed holes | ||
:set -funclutter-valid-hole-fits -fabstract-refinement-hole-fits -frefinement-level-hole-fits=2 | ||
|
||
-- Enable pretty-printing immediately | ||
:pretty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
-- GHCI settings for semantic, collected by running cabal repl -v and checking out the flags cabal passes to ghc. | ||
-- These live here instead of script/repl for ease of commenting. | ||
-- These live here instead of .ghci so cabal repl remains unaffected. | ||
|
||
-- Basic verbosity | ||
:set -v1 | ||
|
||
-- No optimizations | ||
:set -O0 | ||
|
||
-- Compile to object code | ||
:set -fwrite-interface -fobject-code | ||
|
||
-- Write build products to dist-repl (so that we don’t clobber 'cabal build' outputs) | ||
:set -outputdir dist-repl/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build | ||
:set -odir dist-repl/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build | ||
:set -hidir dist-repl/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build | ||
:set -stubdir dist-repl/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build | ||
|
||
-- Look for autogen’d files in dist-repl | ||
:set -idist-repl/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build/autogen | ||
|
||
-- Load all our sources… remember to keep this up to date when we add new packages! | ||
-- But don’t add semantic-source, it’s important that we get that from hackage. | ||
:set -isemantic-analysis/src | ||
:set -isemantic-ast/src | ||
:set -isemantic-core/src | ||
:set -isemantic-java/src | ||
:set -isemantic-json/src | ||
:set -isemantic-python/src | ||
:set -isemantic-tags/src | ||
:set -iapp | ||
:set -isrc | ||
:set -ibench | ||
:set -itest | ||
|
||
-- Default language mode & extensions | ||
:set -XHaskell2010 | ||
:set -XStrictData | ||
|
||
-- Warnings for compiling .hs files | ||
:set -Weverything | ||
:set -Wno-all-missed-specialisations | ||
:set -Wno-implicit-prelude | ||
:set -Wno-missed-specialisations | ||
:set -Wno-missing-import-lists | ||
:set -Wno-missing-local-signatures | ||
:set -Wno-monomorphism-restriction | ||
:set -Wno-name-shadowing | ||
:set -Wno-safe | ||
:set -Wno-unsafe | ||
:set -Wno-star-is-type | ||
-- Bonus: silence “add these modules to your .cabal file” warnings for files we :load | ||
:set -Wno-missing-home-modules | ||
|
||
-- Don’t fail on warnings when in the repl | ||
:set -Wwarn | ||
|
||
-- Warnings for code written in the repl | ||
:seti -Weverything | ||
:seti -Wno-all-missed-specialisations | ||
:seti -Wno-implicit-prelude | ||
:seti -Wno-missed-specialisations | ||
:seti -Wno-missing-import-lists | ||
:seti -Wno-missing-local-signatures | ||
:seti -Wno-monomorphism-restriction | ||
:seti -Wno-name-shadowing | ||
:seti -Wno-safe | ||
:seti -Wno-unsafe | ||
:seti -Wno-star-is-type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,8 @@ profiles | |
cabal.project.local* | ||
dist | ||
dist-newstyle | ||
dist-repl | ||
.ghci | ||
.ghc.environment.* | ||
.ghci_history | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
# Usage: script/repl [ARGS...] | ||
# Run a repl session capable of loading all of the packages and their individual components. Any passed arguments, e.g. module names or flags, will be passed to ghci. | ||
|
||
set -e | ||
|
||
cd $(dirname "$0")/.. | ||
|
||
repl_builddir=dist-repl | ||
|
||
if [[ ! -d $repl_builddir ]]; then | ||
echo "$repl_builddir does not exist, first run 'cabal repl --builddir=$repl_builddir', exit, and then re-run $0" | ||
else | ||
cabal exec --builddir=$repl_builddir ghci -- -ghci-script=.ghci.semantic $@ | ||
fi |