-
Notifications
You must be signed in to change notification settings - Fork 458
Multi component repl #373
Multi component repl #373
Changes from all commits
0aa6eff
f799b3b
73badce
c53e18e
f71ad89
3e0a968
e58bb88
f9bbcb3
df9e7fa
186ed4b
f8b1195
cb7e6b6
b6a9682
5d3c4aa
08f10ee
b6b00a8
9beb6d5
5d361fc
b74256f
3205826
d99fe09
105c036
381728a
abd8216
47b0dac
ade8713
733a0a4
df54afc
7b6e3a5
3710150
2214adb
2d04c23
a637e6e
51884e6
5c8bc78
66c1abd
6863b55
055c842
d030f02
7683376
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
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 |
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 | ||
Comment on lines
+14
to
+21
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 figured out that you can convince ghci to build .dyn_o and .dyn_hi files alongside its usual .o and .hi files, and that this is enough to deal with the build errors I was seeing (cf haskell/cabal#6059). However, while this works well enough in Ultimately, I think we’re better off using a separate dist dir for the time being, tho it breaks my very heart. |
||
|
||
-- 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 | ||
Comment on lines
+53
to
+54
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. This one hits you for every |
||
|
||
-- 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 |
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 | ||
|
||
|
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 |
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’m being a bit opinionated in this file:
I think those are fair statements for working on a variety of tasks, but if your particular workflow is made arduous by this, it’s worth revisiting.