From 442269afd870e347ef6e1187ae9a458135f82188 Mon Sep 17 00:00:00 2001 From: hanjoosten Date: Fri, 17 Jun 2022 17:50:53 +0000 Subject: [PATCH] Add suggestion of https://github.com/haskell/hie-bios/issues/352 --- ReleaseNotes.md | 1 + Setup.hs | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 45ee246fa1..55689a1ea7 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -3,6 +3,7 @@ ## Unreleased changes * [Issue #1293](https://github.com/AmpersandTarski/Ampersand/issues/1293) Fixed a bug in expressions of the form `r;V;s` * Improve devcontainer functionality for developers of Ampersand. +* make the devcontainer experience even smoother (see https://github.com/haskell/hie-bios/issues/352) ## v4.6.3 (28 April 2022) * [Issue #1267](https://github.com/AmpersandTarski/Ampersand/issues/1267) Automatically add ReleaseNotes to release artefacts diff --git a/Setup.hs b/Setup.hs index 0959cc0aa2..a630acfe03 100644 --- a/Setup.hs +++ b/Setup.hs @@ -27,16 +27,27 @@ import System.Process (readProcessWithExitCode) import Prelude (print, putStrLn) main :: IO () -main = defaultMainWithHooks (simpleUserHooks {buildHook = generateHook}) - -generateHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> BuildFlags -> IO () +main = + defaultMainWithHooks + simpleUserHooks + { buildHook = customBuildHook, + replHook = customReplHook + } -- | Generate Haskell modules that are required for the build and start the build -generateHook pd lbi uh bf = do +customBuildHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> BuildFlags -> IO () +customBuildHook pd lbi uh bf = do generateBuildInfoModule (T.pack . prettyShow . pkgVersion . package $ pd) generateStaticFileModule buildHook simpleUserHooks pd lbi uh bf -- start the build +-- | Generate Haskell modules that are required for the build and start the build +customReplHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> ReplFlags -> [String] -> IO () +customReplHook pd lbi uh rf args = do + generateBuildInfoModule (T.pack . prettyShow . pkgVersion . package $ pd) + generateStaticFileModule + replHook simpleUserHooks pd lbi uh rf args -- start the build + generateBuildInfoModule :: Text -> IO () -- | Generate a Haskell module that contains information that is available