From 0aa6effbdfde3529eaf8aa9c717bffe7807833c2 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 14:57:21 -0400 Subject: [PATCH 01/39] :fire: the project-wide .ghci file. --- .ghci | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 .ghci diff --git a/.ghci b/.ghci deleted file mode 100644 index b258954f2f..0000000000 --- a/.ghci +++ /dev/null @@ -1,31 +0,0 @@ --- See docs/💡ProTip!.md -:def! pretty \ _ -> return ":set -interactive-print Semantic.Util.Pretty.prettyShow" -:def! no-pretty \_ -> return ":set -interactive-print System.IO.print" -:def! r \_ -> return (unlines [":reload", ":pretty"]) - --- See docs/💡ProTip!.md for documentation & examples. -:{ -assignmentExample lang = case lang of - "Python" -> mk "py" "python" - "Go" -> mk "go" "go" - "Ruby" -> mk "rb" "ruby" - "JavaScript" -> mk "js" "typescript" - "TypeScript" -> mk "ts" "typescript" - "Haskell" -> mk "hs" "haskell" - "Markdown" -> mk "md" "markdown" - "JSON" -> mk "json" "json" - "Java" -> mk "java" "java" - "PHP" -> mk "php" "php" - _ -> mk "" "" - where mk fileExtension parser = putStrLn ("example: fmap (() <$) . runTask . parse " ++ parser ++ "Parser =<< Semantic.Util.blob \"example." ++ fileExtension ++ "\"") >> return ("import Parsing.Parser\nimport Semantic.Task\nimport Semantic.Util") -:} -:def! assignment assignmentExample - --- Enable breaking on errors for code written in the repl. -:seti -fbreak-on-error - --- Continue loading after warnings when in the repl. -:set -Wwarn - --- Use a cyan lambda as the prompt. -:set prompt "\ESC[1;36m\STXλ \ESC[m\STX" From f799b3b7599065f29ffc2118791388c73743c72b Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 15:00:05 -0400 Subject: [PATCH 02/39] Ignore dist-repl. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 6ad025336b..0a5922aab0 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ profiles cabal.project.local* dist dist-newstyle +dist-repl .ghc.environment.* .ghci_history From 73badce74d702a7e3c08d6213cc1b0ac3cd4f07d Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 15:18:43 -0400 Subject: [PATCH 03/39] Add a script to run ghci. --- script/repl | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 script/repl diff --git a/script/repl b/script/repl new file mode 100755 index 0000000000..a081b5716c --- /dev/null +++ b/script/repl @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +cd $(dirname "$0")/.. + +cabal exec --builddir=dist-repl ghci -- $@ From c53e18e2637fffcff8459d617a189b840b8500a3 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 15:18:56 -0400 Subject: [PATCH 04/39] Add a .ghci file configured to set up the project loading &c. --- .ghci | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .ghci diff --git a/.ghci b/.ghci new file mode 100644 index 0000000000..3d964689cc --- /dev/null +++ b/.ghci @@ -0,0 +1,44 @@ +:set -j -v1 -fwrite-interface -fobject-code +:set -O0 + +:set -idist-newstyle/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build/autogen + +:set -Idist-newstyle/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build/autogen + +: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 -isrc +:set -ibench +:set -itest + +:set -XHaskell2010 + +: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 +:set -Wno-missing-home-modules + +: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 From f71ad89725d931e61a3bbdc4bce32df0d4ef1c67 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 15:34:18 -0400 Subject: [PATCH 05/39] Use dist-repl import paths. --- .ghci | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.ghci b/.ghci index 3d964689cc..c8e7676f12 100644 --- a/.ghci +++ b/.ghci @@ -1,9 +1,8 @@ :set -j -v1 -fwrite-interface -fobject-code :set -O0 -:set -idist-newstyle/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build/autogen -:set -Idist-newstyle/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build/autogen +:set -idist-repl/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build/autogen :set -isemantic-analysis/src :set -isemantic-ast/src From 3e0a9686355ffe4dc97d89f4f229582a1ad67333 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 15:34:29 -0400 Subject: [PATCH 06/39] Set the output, o, hi, and stub dirs to dist-repl. --- .ghci | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.ghci b/.ghci index c8e7676f12..2dc8a34681 100644 --- a/.ghci +++ b/.ghci @@ -1,6 +1,10 @@ :set -j -v1 -fwrite-interface -fobject-code :set -O0 +: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 :set -idist-repl/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build/autogen From e58bb8825fa8d70bbc0f0803b0d62a4a7b3870ab Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 15:36:32 -0400 Subject: [PATCH 07/39] Enable StrictData. --- .ghci | 1 + 1 file changed, 1 insertion(+) diff --git a/.ghci b/.ghci index 2dc8a34681..01f4c336fd 100644 --- a/.ghci +++ b/.ghci @@ -20,6 +20,7 @@ :set -itest :set -XHaskell2010 +:set -XStrictData :set -Weverything :set -Wno-all-missed-specialisations From f9bbcb3b649cc09a9a48669e24d592b40c519fb7 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 15:44:03 -0400 Subject: [PATCH 08/39] Comment the .ghci file --- .ghci | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.ghci b/.ghci index 01f4c336fd..7e2d18d8ff 100644 --- a/.ghci +++ b/.ghci @@ -1,13 +1,21 @@ -:set -j -v1 -fwrite-interface -fobject-code +-- Basic verbosity & compiler parallelization +:set -j -v1 + +-- Compile to object code +:set -fwrite-interface -fobject-code :set -O0 +-- Write build products to dist-repl :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 @@ -19,9 +27,11 @@ :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 @@ -33,8 +43,10 @@ :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 +-- Warnings for code written in the repl :seti -Weverything :seti -Wno-all-missed-specialisations :seti -Wno-implicit-prelude From df9e7fa1b28d459472bc9ab75046e3ef383f4775 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 15:44:58 -0400 Subject: [PATCH 09/39] Note how we came by this. --- .ghci | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.ghci b/.ghci index 7e2d18d8ff..97b2d52989 100644 --- a/.ghci +++ b/.ghci @@ -1,3 +1,5 @@ +-- GHCI settings for semantic, collected by running cabal repl -v and checking out the flags cabal passes to ghc. + -- Basic verbosity & compiler parallelization :set -j -v1 From 186ed4b74c413fa29028b7cfc3304deb305e5447 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 15:45:45 -0400 Subject: [PATCH 10/39] Turn off -Werror in the repl. --- .ghci | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.ghci b/.ghci index 97b2d52989..a6e83f90d8 100644 --- a/.ghci +++ b/.ghci @@ -48,6 +48,9 @@ -- 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 From f8b119598d5284401871fbfa6dac6a50482873be Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 15:49:55 -0400 Subject: [PATCH 11/39] Add back in the pretty-printing stuff but tell people to put it in their own .ghci files. --- .ghci | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.ghci b/.ghci index a6e83f90d8..04eb53abc5 100644 --- a/.ghci +++ b/.ghci @@ -63,3 +63,19 @@ :seti -Wno-safe :seti -Wno-unsafe :seti -Wno-star-is-type + +-- Consider adding these to your ~/.ghc/ghci.conf file: +-- -- Pretty-printing +-- :set -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" + +-- -- 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" From cb7e6b6b5b95c3eb8d04b633cf433394b866b49e Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 15:50:07 -0400 Subject: [PATCH 12/39] Spacing. --- .ghci | 1 + 1 file changed, 1 insertion(+) diff --git a/.ghci b/.ghci index 04eb53abc5..8e9ba18e4c 100644 --- a/.ghci +++ b/.ghci @@ -65,6 +65,7 @@ :seti -Wno-star-is-type -- Consider adding these to your ~/.ghc/ghci.conf file: + -- -- Pretty-printing -- :set -package pretty-simple -- :def! pretty \ _ -> pure ":set -interactive-print Text.Pretty.Simple.pPrint" From b6a9682d361649c35ead0bd03bd39dde2ec846be Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 15:52:06 -0400 Subject: [PATCH 13/39] Propose some more flags. --- .ghci | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.ghci b/.ghci index 8e9ba18e4c..27b3629b0e 100644 --- a/.ghci +++ b/.ghci @@ -80,3 +80,12 @@ -- -- 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 From 5d3c4aa35931c831fc0fe48c3e32c9c8a83129fb Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 15:59:14 -0400 Subject: [PATCH 14/39] Propose some language extensions. --- .ghci | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.ghci b/.ghci index 27b3629b0e..45cb47d59b 100644 --- a/.ghci +++ b/.ghci @@ -72,6 +72,9 @@ -- :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 From 08f10ee16d2cd1c6f8f10a37f6c6be5227ccea32 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 15:59:30 -0400 Subject: [PATCH 15/39] Add some setup instructions. --- script/repl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/script/repl b/script/repl index a081b5716c..7b45d91c88 100755 --- a/script/repl +++ b/script/repl @@ -4,4 +4,10 @@ set -e cd $(dirname "$0")/.. -cabal exec --builddir=dist-repl ghci -- $@ +repl_builddir=dist-repl + +if [[ ! -d $repl_builddir ]]; then + echo "$repl_builddir does not exist, first run 'cabal repl --builddir=$replbuilddir', exit, and then run script/repl" +else + cabal exec --builddir=$repl_builddir ghci -- $@ +fi From b6b00a8444bd5de6478b99a9a913089a79fb06a3 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 16:00:20 -0400 Subject: [PATCH 16/39] =?UTF-8?q?Note=20why=20these=20aren=E2=80=99t=20in?= =?UTF-8?q?=20script/repl.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .ghci | 1 + 1 file changed, 1 insertion(+) diff --git a/.ghci b/.ghci index 45cb47d59b..5c03860254 100644 --- a/.ghci +++ b/.ghci @@ -1,4 +1,5 @@ -- GHCI settings for semantic, collected by running cabal repl -v and checking out the flags cabal passes to ghc. +-- These have been added here instead of to script/repl so that they can be overridden on the CLI. -- Basic verbosity & compiler parallelization :set -j -v1 From 9beb6d5941d7d996bb12501081aa609c65cc6235 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 16:01:41 -0400 Subject: [PATCH 17/39] :fire: -j. --- .ghci | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.ghci b/.ghci index 5c03860254..cae9472e2b 100644 --- a/.ghci +++ b/.ghci @@ -1,12 +1,14 @@ -- GHCI settings for semantic, collected by running cabal repl -v and checking out the flags cabal passes to ghc. -- These have been added here instead of to script/repl so that they can be overridden on the CLI. --- Basic verbosity & compiler parallelization -:set -j -v1 +-- Basic verbosity +:set -v1 + +-- No optimizations +:set -O0 -- Compile to object code :set -fwrite-interface -fobject-code -:set -O0 -- Write build products to dist-repl :set -outputdir dist-repl/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build From 5d361fc8ed76aac9b7caf0dc0ad140f93b25c483 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 16:03:38 -0400 Subject: [PATCH 18/39] Comments. --- .ghci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ghci b/.ghci index cae9472e2b..c3d3692a45 100644 --- a/.ghci +++ b/.ghci @@ -1,5 +1,5 @@ -- GHCI settings for semantic, collected by running cabal repl -v and checking out the flags cabal passes to ghc. --- These have been added here instead of to script/repl so that they can be overridden on the CLI. +-- These have been added here instead of to script/repl so that we can comment them. -- Basic verbosity :set -v1 From b74256fb858aae9e2d816a04c17c54e8ce5b9e64 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 16:05:22 -0400 Subject: [PATCH 19/39] =?UTF-8?q?Move=20the=20.ghci=20file=20so=20it=20doe?= =?UTF-8?q?sn=E2=80=99t=20affect=20`cabal=20repl`.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .ghci => .ghci.semantic | 0 script/repl | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename .ghci => .ghci.semantic (100%) diff --git a/.ghci b/.ghci.semantic similarity index 100% rename from .ghci rename to .ghci.semantic diff --git a/script/repl b/script/repl index 7b45d91c88..60989d70a5 100755 --- a/script/repl +++ b/script/repl @@ -9,5 +9,5 @@ repl_builddir=dist-repl if [[ ! -d $repl_builddir ]]; then echo "$repl_builddir does not exist, first run 'cabal repl --builddir=$replbuilddir', exit, and then run script/repl" else - cabal exec --builddir=$repl_builddir ghci -- $@ + cabal exec --builddir=$repl_builddir ghci -- -ghci-script=.ghci.semantic $@ fi From 3205826b258d0f72ebd9c4e5e887943f7a74bc23 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 16:05:49 -0400 Subject: [PATCH 20/39] Move the proposed additions to the .ghci file. --- .ghci | 28 ++++++++++++++++++++++++++++ .ghci.semantic | 29 ----------------------------- 2 files changed, 28 insertions(+), 29 deletions(-) create mode 100644 .ghci diff --git a/.ghci b/.ghci new file mode 100644 index 0000000000..ecc58dc74b --- /dev/null +++ b/.ghci @@ -0,0 +1,28 @@ +-- Consider adding these to your ~/.ghc/ghci.conf file: + +-- -- Pretty-printing +-- :set -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 diff --git a/.ghci.semantic b/.ghci.semantic index c3d3692a45..8667b12f85 100644 --- a/.ghci.semantic +++ b/.ghci.semantic @@ -66,32 +66,3 @@ :seti -Wno-safe :seti -Wno-unsafe :seti -Wno-star-is-type - --- Consider adding these to your ~/.ghc/ghci.conf file: - --- -- Pretty-printing --- :set -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 From d99fe09cdbc59d805ff55155745fc738af5793c5 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 16:08:42 -0400 Subject: [PATCH 21/39] Usage for script/repl. --- script/repl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script/repl b/script/repl index 60989d70a5..4c407f30fd 100755 --- a/script/repl +++ b/script/repl @@ -1,4 +1,6 @@ #!/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 From 105c0362dc7c4d52aca18262b7bd8b556e3edece Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 16:09:02 -0400 Subject: [PATCH 22/39] =?UTF-8?q?Add=20the=20app=20component=E2=80=99s=20p?= =?UTF-8?q?ath.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .ghci.semantic | 1 + 1 file changed, 1 insertion(+) diff --git a/.ghci.semantic b/.ghci.semantic index 8667b12f85..bf3bc73fe4 100644 --- a/.ghci.semantic +++ b/.ghci.semantic @@ -28,6 +28,7 @@ :set -isemantic-json/src :set -isemantic-python/src :set -isemantic-tags/src +:set -iapp :set -isrc :set -ibench :set -itest From 381728a4188ee1bbdccec2f6623aaa1d46dee1e4 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 16:10:40 -0400 Subject: [PATCH 23/39] =?UTF-8?q?Note=20why=20we=E2=80=99re=20using=20a=20?= =?UTF-8?q?separate=20directory.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .ghci.semantic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ghci.semantic b/.ghci.semantic index bf3bc73fe4..518fd6d9e9 100644 --- a/.ghci.semantic +++ b/.ghci.semantic @@ -10,7 +10,7 @@ -- Compile to object code :set -fwrite-interface -fobject-code --- Write build products to dist-repl +-- 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 From abd8216865d538764f964051fd01e889ec4bd3b4 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 16:11:33 -0400 Subject: [PATCH 24/39] $0 --- script/repl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/repl b/script/repl index 4c407f30fd..9e991bbed0 100755 --- a/script/repl +++ b/script/repl @@ -9,7 +9,7 @@ cd $(dirname "$0")/.. repl_builddir=dist-repl if [[ ! -d $repl_builddir ]]; then - echo "$repl_builddir does not exist, first run 'cabal repl --builddir=$replbuilddir', exit, and then run script/repl" + echo "$repl_builddir does not exist, first run 'cabal repl --builddir=$replbuilddir', exit, and then re-run $0" else cabal exec --builddir=$repl_builddir ghci -- -ghci-script=.ghci.semantic $@ fi From 47b0dac3d86e076b730e8e84f3798cecc4a3ae3c Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 16:25:57 -0400 Subject: [PATCH 25/39] =?UTF-8?q?Build=20both=20static=20&=20dynamic=20fil?= =?UTF-8?q?es=20so=20we=20don=E2=80=99t=20have=20to=20live=20in=20a=20sepa?= =?UTF-8?q?rate=20build=20dir.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .ghci.semantic | 19 ++++++++++++------- script/repl | 8 +------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.ghci.semantic b/.ghci.semantic index 518fd6d9e9..006bf00c1c 100644 --- a/.ghci.semantic +++ b/.ghci.semantic @@ -9,15 +9,20 @@ -- Compile to object code :set -fwrite-interface -fobject-code +-- Build both static & dynamic objects so we don’t confuse cabal build +:set -static +:set -dynamic-too +:set -dynosuf dyn_o +:set -dynhisuf dyn_hi --- 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 +-- Write build products to dist-newstyle (instead of alongside the .hs files) +:set -outputdir dist-newstyle/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build +:set -odir dist-newstyle/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build +:set -hidir dist-newstyle/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build +:set -stubdir dist-newstyle/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 +-- Look for autogen’d files in dist-newstyle +:set -idist-newstyle/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. diff --git a/script/repl b/script/repl index 9e991bbed0..ba116a7b5a 100755 --- a/script/repl +++ b/script/repl @@ -6,10 +6,4 @@ 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=$replbuilddir', exit, and then re-run $0" -else - cabal exec --builddir=$repl_builddir ghci -- -ghci-script=.ghci.semantic $@ -fi +cabal exec ghci -- -ghci-script=.ghci.semantic $@ From ade87132f60859b57705f48a2b164f11007c6de6 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 16:27:54 -0400 Subject: [PATCH 26/39] Clarify why these things are in this file. --- .ghci.semantic | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.ghci.semantic b/.ghci.semantic index 006bf00c1c..a42cb6cc6c 100644 --- a/.ghci.semantic +++ b/.ghci.semantic @@ -1,5 +1,6 @@ -- GHCI settings for semantic, collected by running cabal repl -v and checking out the flags cabal passes to ghc. --- These have been added here instead of to script/repl so that we can comment them. +-- 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 From 733a0a4628eb9190d5ceec06c1c6ca466875c795 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 30 Oct 2019 16:34:16 -0400 Subject: [PATCH 27/39] =?UTF-8?q?Revert=20"Build=20both=20static=20&=20dyn?= =?UTF-8?q?amic=20files=20so=20we=20don=E2=80=99t=20have=20to=20live=20in?= =?UTF-8?q?=20a=20separate=20build=20dir."?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 47b0dac3d86e076b730e8e84f3798cecc4a3ae3c. --- .ghci.semantic | 19 +++++++------------ script/repl | 8 +++++++- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.ghci.semantic b/.ghci.semantic index a42cb6cc6c..e34f0a0d54 100644 --- a/.ghci.semantic +++ b/.ghci.semantic @@ -10,20 +10,15 @@ -- Compile to object code :set -fwrite-interface -fobject-code --- Build both static & dynamic objects so we don’t confuse cabal build -:set -static -:set -dynamic-too -:set -dynosuf dyn_o -:set -dynhisuf dyn_hi --- Write build products to dist-newstyle (instead of alongside the .hs files) -:set -outputdir dist-newstyle/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build -:set -odir dist-newstyle/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build -:set -hidir dist-newstyle/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build -:set -stubdir dist-newstyle/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build +-- 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-newstyle -:set -idist-newstyle/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build/autogen +-- 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. diff --git a/script/repl b/script/repl index ba116a7b5a..9e991bbed0 100755 --- a/script/repl +++ b/script/repl @@ -6,4 +6,10 @@ set -e cd $(dirname "$0")/.. -cabal exec ghci -- -ghci-script=.ghci.semantic $@ +repl_builddir=dist-repl + +if [[ ! -d $repl_builddir ]]; then + echo "$repl_builddir does not exist, first run 'cabal repl --builddir=$replbuilddir', exit, and then re-run $0" +else + cabal exec --builddir=$repl_builddir ghci -- -ghci-script=.ghci.semantic $@ +fi From 7b6e3a5d02c3afce7dd20124bf451e234f19ab9d Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 1 Nov 2019 08:45:47 -0400 Subject: [PATCH 28/39] Rename .ghci to .ghci.default. --- .ghci => .ghci.default | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .ghci => .ghci.default (100%) diff --git a/.ghci b/.ghci.default similarity index 100% rename from .ghci rename to .ghci.default From 37101507173b6cfea0096232d8dc730bac04847d Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 1 Nov 2019 08:46:43 -0400 Subject: [PATCH 29/39] Uncomment the proposed .ghci file. --- .ghci.default | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.ghci.default b/.ghci.default index ecc58dc74b..dfdee8714e 100644 --- a/.ghci.default +++ b/.ghci.default @@ -1,28 +1,28 @@ --- Consider adding these to your ~/.ghc/ghci.conf file: +-- Consider copying this to your ~/.ghc/ghci.conf file: --- -- Pretty-printing --- :set -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" +-- Pretty-printing +:set -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 +-- Turn on some language extensions you use a lot +:seti -XFlexibleContexts -XOverloadedStrings -XTypeApplications --- -- Break on errors --- :seti -fbreak-on-error +-- Break on errors +:seti -fbreak-on-error --- -- Automatically show the code around breakpoints --- :set stop :list +-- 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" +-- 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 +-- Better errors +:set -ferror-spans -freverse-errors -fprint-expanded-synonyms --- -- Path-local ghci history --- :set -flocal-ghci-history +-- 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 +-- Better typed holes +:set -funclutter-valid-hole-fits -fabstract-refinement-hole-fits -frefinement-level-hole-fits=2 From 2214adb4607b80aa599ccbd50f64a1ee299e1a9a Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 1 Nov 2019 09:00:16 -0400 Subject: [PATCH 30/39] Rename ghci.default to ghci.sample. --- .ghci.default => .ghci.sample | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .ghci.default => .ghci.sample (100%) diff --git a/.ghci.default b/.ghci.sample similarity index 100% rename from .ghci.default rename to .ghci.sample From 2d04c2349141bfe02bf6620b4e2149ca16caa6f9 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 1 Nov 2019 09:02:45 -0400 Subject: [PATCH 31/39] Ignore .ghci. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 0a5922aab0..adba497525 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ cabal.project.local* dist dist-newstyle dist-repl +.ghci .ghc.environment.* .ghci_history From a637e6e5a844c00df357b17f909e4ed2af2a2582 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 1 Nov 2019 09:03:56 -0400 Subject: [PATCH 32/39] :fire: a redundant link. --- "docs/\360\237\222\241ProTip!.md" | 2 -- 1 file changed, 2 deletions(-) diff --git "a/docs/\360\237\222\241ProTip!.md" "b/docs/\360\237\222\241ProTip!.md" index f65e3ca71a..f9d6850f15 100644 --- "a/docs/\360\237\222\241ProTip!.md" +++ "b/docs/\360\237\222\241ProTip!.md" @@ -150,8 +150,6 @@ _Voilà!_ You’re now looking at the source code for the datatype generated fro The Haskell interactive repl (GHCi) allows you to quickly typecheck your work and test out ideas interactively. It’s always worth having a repl open, but we’ve particularly tuned some workflows, e.g. semantic assignment development, for the repl. -[pretty-printing]: pretty-printing - ### Configuration From 51884e68dd085f849908a307f822167498dfd391 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 1 Nov 2019 09:10:49 -0400 Subject: [PATCH 33/39] Fix a typo. --- script/repl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/repl b/script/repl index 9e991bbed0..e3b153a573 100755 --- a/script/repl +++ b/script/repl @@ -9,7 +9,7 @@ cd $(dirname "$0")/.. repl_builddir=dist-repl if [[ ! -d $repl_builddir ]]; then - echo "$repl_builddir does not exist, first run 'cabal repl --builddir=$replbuilddir', exit, and then re-run $0" + 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 From 5c8bc7846ab503b52d67cdd45bbe1183741f3c17 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 1 Nov 2019 09:37:52 -0400 Subject: [PATCH 34/39] Remove some stuff. --- "docs/\360\237\222\241ProTip!.md" | 47 ------------------------------- 1 file changed, 47 deletions(-) diff --git "a/docs/\360\237\222\241ProTip!.md" "b/docs/\360\237\222\241ProTip!.md" index f9d6850f15..d3aca7849f 100644 --- "a/docs/\360\237\222\241ProTip!.md" +++ "b/docs/\360\237\222\241ProTip!.md" @@ -201,53 +201,6 @@ You can use `:pretty` & `:no-pretty` like so: ``` -### Working in Assignment - -When working in assignment, some setup is required. This macro automates that by automatically importing the necessary modules and outputs an example command. If you provide the language you are working with as an optional parameter, the example command is formatted for that language's specific needs (parser, example file extension, etc.). - -The macro is defined as: - -``` -:{ -assignmentExample lang = case lang of - "Python" -> mk "py" "python" - "Go" -> mk "go" "go" - "Ruby" -> mk "rb" "ruby" - "JavaScript" -> mk "js" "typescript" - "TypeScript" -> mk "ts" "typescript" - "Haskell" -> mk "hs" "haskell" - "Markdown" -> mk "md" "markdown" - "JSON" -> mk "json" "json" - _ -> mk "" "" - where mk fileExtension parser = putStrLn ("example: fmap (() <$) . runTask . parse " ++ parser ++ "Parser =<< Semantic.Util.blob \"example." ++ fileExtension ++ "\"") >> return ("import Parsing.Parser\nimport Semantic.Task\nimport Semantic.Util") -:} - -:def assignment assignmentExample -``` - -And is invoked in GHCi like: - -``` -λ :assignment Python -``` - -The output produces a one line expression assuming the syntax to assign is in a file named `example` with the relevant programming language extension: - -```haskell -quieterm <$> parseFile pythonParser "example.py" -``` - - -### Inspecting TreeSitter ASTs - -Inspecting the parse tree from TreeSitter can be helpful for debugging. In GHCi, the command below allows viewing the TreeSitter production name of each node in the TreeSitter AST: - -```haskell -import TreeSitter.Java -fmap nodeSymbol <$> parseFile javaASTParser "example.java" -``` - - ### Using Threadscope Threadscope is a tool for profiling the multi-threaded performance of Haskell programs. It allows us to see how work is shared across processors and identify performance issues related to garbage collection or bottlenecks in our processes. From 66c1abd52986a78b3df1fd0fbfa84d449d386647 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 1 Nov 2019 09:38:01 -0400 Subject: [PATCH 35/39] Promote the threadscope section out of the ghci section. --- "docs/\360\237\222\241ProTip!.md" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/docs/\360\237\222\241ProTip!.md" "b/docs/\360\237\222\241ProTip!.md" index d3aca7849f..105039bfef 100644 --- "a/docs/\360\237\222\241ProTip!.md" +++ "b/docs/\360\237\222\241ProTip!.md" @@ -201,7 +201,7 @@ You can use `:pretty` & `:no-pretty` like so: ``` -### Using Threadscope +## Using Threadscope Threadscope is a tool for profiling the multi-threaded performance of Haskell programs. It allows us to see how work is shared across processors and identify performance issues related to garbage collection or bottlenecks in our processes. From 6863b55dc0ef88477a07c6654415741854043fa7 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 1 Nov 2019 09:38:07 -0400 Subject: [PATCH 36/39] Simplify the threadscope steps. --- "docs/\360\237\222\241ProTip!.md" | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git "a/docs/\360\237\222\241ProTip!.md" "b/docs/\360\237\222\241ProTip!.md" index 105039bfef..32684bc23a 100644 --- "a/docs/\360\237\222\241ProTip!.md" +++ "b/docs/\360\237\222\241ProTip!.md" @@ -207,7 +207,6 @@ Threadscope is a tool for profiling the multi-threaded performance of Haskell pr To install threadscope: -1. Download a prebuilt binary from https://github.com/haskell/ThreadScope/releases . -2. `chmod a+x` the result of extracting the release. -3. `brew install gtk+ gtk-mac-integration`. -4. profit. +1. Download a prebuilt binary from https://github.com/haskell/ThreadScope/releases +2. `chmod a+x` the result of extracting the release +3. `brew install gtk+ gtk-mac-integration` From 055c8424ee3b0470f6ade58116556d9079137519 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 1 Nov 2019 09:38:52 -0400 Subject: [PATCH 37/39] Rewrite the ghci section. --- "docs/\360\237\222\241ProTip!.md" | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git "a/docs/\360\237\222\241ProTip!.md" "b/docs/\360\237\222\241ProTip!.md" index 32684bc23a..8c36f2b238 100644 --- "a/docs/\360\237\222\241ProTip!.md" +++ "b/docs/\360\237\222\241ProTip!.md" @@ -148,17 +148,27 @@ _Voilà!_ You’re now looking at the source code for the datatype generated fro ## GHCi -The Haskell interactive repl (GHCi) allows you to quickly typecheck your work and test out ideas interactively. It’s always worth having a repl open, but we’ve particularly tuned some workflows, e.g. semantic assignment development, for the repl. +The Haskell interactive repl (GHCi) allows you to quickly typecheck your work and test out ideas interactively. It’s always worth having a repl open, and we’ve particularly tuned some workflows for the repl. +Full docs for ghci can be found in the [user’s guide][ghci user’s guide]. -### Configuration +[ghci user’s guide]: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html -We configure `ghci` with defaults & macros for use with `semantic` via the [`.ghci` file][] at the project root, and you can further customize its behaviour via the `~/.ghci` file. -Full docs for ghci can be found in the [user’s guide][ghci user’s guide]. +### Multiple components -[ghci user’s guide]: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html -[`.ghci` file]: https://github.com/github/semantic/blob/master/.ghci +`semantic` consists of multiple packages and components, which makes it somewhat challenging to load into `ghci` using e.g. `cabal repl`. To help that, we provide [`script/repl`][] to automate working with multiple components & packages. Unlike when using `cabal repl`, after loading you will need to explicitly `:load` (at least some of) the sources you need to work with. For example, when working in the main `semantic` package, almost everything can be loaded with `:load Semantic.CLI`, since the `Semantic.CLI` module ultimately depends on just about everything else in the repo. + +This script is also set up to store intermediate build products in a separate `dist-repl` dir to avoid colliding with normal builds. + +[`script/repl`]: https://github.com/github/semantic/blob/master/script/repl + + +### Configuration + +`ghci` can be configured with scripts containing Haskell statements and repl commands. By default, the `~/.ghc/ghci.conf` file will be loaded, as well as a `.ghci` file in the working directory, if any. We don’t currently provide such for use with `semantic`, but we do provide a [`.ghci.sample`][] file which we suggest copying to `~/.ghc/ghci.conf` for better typed holes, pretty-printing via `pretty-simple`, and a simple prompt. + +[`.ghci.sample`]: https://github.com/github/semantic/blob/master/.ghci.sample ### Managing history @@ -176,9 +186,9 @@ maxHistorySize: Nothing ### Pretty-printing -By default, GHCi prints the results of expressions using their `Show` instances, which can be particularly difficult to read for large recursive structures like `Term`s and `Diff`s. The project’s [`.ghci` file][] provides `:pretty` & `:no-pretty` macros which respectively enable & disable colourized, pretty-printed formatting of result values instead. These macros depend on the the `pretty-show` & `hscolour` packages. +By default, GHCi prints the results of expressions using their `Show` instances, which can be particularly difficult to read for large recursive structures like `Term`s and `Diff`s. The project’s [`.ghci.sample`][] file provides `:pretty` & `:no-pretty` macros which respectively enable & disable colourized, pretty-printed formatting of result values instead. These macros depend on the the `pretty-simple` package. -Since `:reload`ing resets local bindings, the [`.ghci` file][] also provides a convenient `:r` macro which reloads and then immediately re-enables `:pretty`. +Since `:reload`ing resets local bindings, the file also provides a convenient `:r` macro which reloads and then immediately re-enables `:pretty`. You can use `:pretty` & `:no-pretty` like so: From d030f028da82f21206cedc2edffb12f725b55b4e Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 1 Nov 2019 09:58:14 -0400 Subject: [PATCH 38/39] Ignore pretty-simple before loading it to avoid multiple loaded copies. --- .ghci.sample | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ghci.sample b/.ghci.sample index dfdee8714e..429c306031 100644 --- a/.ghci.sample +++ b/.ghci.sample @@ -1,7 +1,7 @@ -- Consider copying this to your ~/.ghc/ghci.conf file: -- Pretty-printing -:set -package pretty-simple +: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" From 76833768a4ab818994f6b00bbd5c616352258192 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 1 Nov 2019 09:58:22 -0400 Subject: [PATCH 39/39] Enable pretty-printing immediately. --- .ghci.sample | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.ghci.sample b/.ghci.sample index 429c306031..dcbd090ba3 100644 --- a/.ghci.sample +++ b/.ghci.sample @@ -26,3 +26,6 @@ -- Better typed holes :set -funclutter-valid-hole-fits -fabstract-refinement-hole-fits -frefinement-level-hole-fits=2 + +-- Enable pretty-printing immediately +:pretty