From patchwork Tue Apr 19 23:31:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 38670 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 2C25527BBEA; Wed, 20 Apr 2022 00:33:37 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 0D41927BBE9 for ; Wed, 20 Apr 2022 00:33:36 +0100 (BST) Received: from localhost ([::1]:41040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngxLj-0003Jl-6y for patchwork@mira.cbaines.net; Tue, 19 Apr 2022 19:33:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41148) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ngxLB-0003JQ-W3 for guix-patches@gnu.org; Tue, 19 Apr 2022 19:33:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50527) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngxLB-0001sr-MR for guix-patches@gnu.org; Tue, 19 Apr 2022 19:33:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ngxLB-0005xD-J4 for guix-patches@gnu.org; Tue, 19 Apr 2022 19:33:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55030] [PATCH 01/30] gnu: elm-compiler: Update to 0.19.1. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 19 Apr 2022 23:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55030 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55030@debbugs.gnu.org Cc: Philip McGrath Received: via spool by 55030-submit@debbugs.gnu.org id=B55030.165041117922874 (code B ref 55030); Tue, 19 Apr 2022 23:33:01 +0000 Received: (at 55030) by debbugs.gnu.org; 19 Apr 2022 23:32:59 +0000 Received: from localhost ([127.0.0.1]:44423 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ngxL1-0005wf-Qp for submit@debbugs.gnu.org; Tue, 19 Apr 2022 19:32:59 -0400 Received: from mail-vs1-f54.google.com ([209.85.217.54]:46757) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ngxKz-0005wR-Ql for 55030@debbugs.gnu.org; Tue, 19 Apr 2022 19:32:50 -0400 Received: by mail-vs1-f54.google.com with SMTP id b128so16986vsc.13 for <55030@debbugs.gnu.org>; Tue, 19 Apr 2022 16:32:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philipmcgrath.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HwzclTGL+yXB+JUD0bhutc8NXH7Ym+6fKhe/Hd6Ldek=; b=Y4oHHhwUnOnc15EARvd7ynX9Eucjyw2OG/ra3slPEfASUMf9S7jU1acIcZMSPgKPLH 0+KwcovDe/pP8h+ivnyxGDES9qSPlnw0xcDARPcCNd75L7PcSwWd2MWnN2Ht11UgxMZp kjIGw4hvmcIjdWQ+ENZ3g95RFJl5WEsVEfkvBLFQURbTuzFKR5uG8rwevTy3PZIuwhGz QmF08ATyw/mUOyz+wTKH4T6ap9UFUFRVBePzPwWQf8ETSqvn+foXvJ1aybUC3ej9hLYj yCmsr7nH0wJPqRdnUyw/EO28uWrzefNSmYiSRGQYSkhN8zxoYaP8MEJBOA+YFyH5yQqf P58Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HwzclTGL+yXB+JUD0bhutc8NXH7Ym+6fKhe/Hd6Ldek=; b=OatWUgtwym8toHuHoo0T3hukVN3M8lKipjkKGRkhLPOrA24YThQYzLujr5jvMv/BYd oihKad5E/BAml94mhP/5hcnhPNcPhPQxIvOX1IC4iTArPcRN9YYKJIRjeU+29y7Rw01c UhRYbRPTPbdbKbGCFyLh8h9wCsIW1YCVI/BM9Idte6Bby6J/IWoUpZJIndbZfBezBxEs ugSK0VDNHiYfDKVSU8BRgA+S2PL1kU+c52PCYsBDyiQLQfy97wJOuzooJ06jJUNDFDP2 3KZLaylL8pG9RxW//XPi9+soEcVw7CtwRpnsMEOTsnD8uzwiup1kfLSkbGi/Hharg7BI 6q/A== X-Gm-Message-State: AOAM5313fgrskQyl/L2A5TltOfWlq0sAnJwUANJjv3+HCkpP1P1poy6Z 3zle3p24SCvEMKUSHy3n1XcT/9HPlk8hqez+ X-Google-Smtp-Source: ABdhPJxwoIr/0O6jr6i4vR46tC+LE7qEYui0GotrQlkbaUs7Vy2+4u82JIGdUTX665gD2h19y9Y17g== X-Received: by 2002:a67:b607:0:b0:32a:1dfa:3fdd with SMTP id d7-20020a67b607000000b0032a1dfa3fddmr5728310vsm.55.1650411163871; Tue, 19 Apr 2022 16:32:43 -0700 (PDT) Received: from localhost (c-73-125-98-51.hsd1.fl.comcast.net. [73.125.98.51]) by smtp.gmail.com with UTF8SMTPSA id o11-20020ab0150b000000b0035ccb91e501sm170372uae.36.2022.04.19.16.32.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Apr 2022 16:32:43 -0700 (PDT) From: Philip McGrath Date: Tue, 19 Apr 2022 19:31:45 -0400 Message-Id: <20220419233214.275789-1-philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220419232736.272970-1-philip@philipmcgrath.com> References: <20220419232736.272970-1-philip@philipmcgrath.com> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/patches/elm-compiler-disable-reactor.patch, gnu/packages/patches/elm-compiler-fix-map-key.patch: Delete files. * gnu/packages/patches/elm-reactor-static-files.patch: New file. * gnu/local.mk (dist_patch_DATA): Update accordingly. * gnu/packages/elm.scm (elm-compiler): Update to 0.19.1. [origin]: Remove stale patches. Add new patch. [arguments]: Use G-expressions. Add #:configure-flags for new patch. [inputs]: Remove ghc-file-embed. Add ghc-filelock. --- gnu/local.mk | 3 +- gnu/packages/elm.scm | 42 +-- .../elm-compiler-disable-reactor.patch | 71 ----- .../patches/elm-compiler-fix-map-key.patch | 38 --- .../patches/elm-reactor-static-files.patch | 251 ++++++++++++++++++ 5 files changed, 278 insertions(+), 127 deletions(-) delete mode 100644 gnu/packages/patches/elm-compiler-disable-reactor.patch delete mode 100644 gnu/packages/patches/elm-compiler-fix-map-key.patch create mode 100644 gnu/packages/patches/elm-reactor-static-files.patch diff --git a/gnu/local.mk b/gnu/local.mk index 0e721236d9..2af4d018ba 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1024,8 +1024,7 @@ dist_patch_DATA = \ %D%/packages/patches/einstein-build.patch \ %D%/packages/patches/elfutils-tests-ptrace.patch \ %D%/packages/patches/elixir-path-length.patch \ - %D%/packages/patches/elm-compiler-disable-reactor.patch \ - %D%/packages/patches/elm-compiler-fix-map-key.patch \ + %D%/packages/patches/elm-reactor-static-files.patch \ %D%/packages/patches/elogind-revert-polkit-detection.patch \ %D%/packages/patches/emacs-exec-path.patch \ %D%/packages/patches/emacs-fix-scheme-indent-function.patch \ diff --git a/gnu/packages/elm.scm b/gnu/packages/elm.scm index ca7c61041b..708c1cf0d2 100644 --- a/gnu/packages/elm.scm +++ b/gnu/packages/elm.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2019 Robert Vollmert +;;; Copyright © 2022 Philip McGrath ;;; ;;; This file is part of GNU Guix. ;;; @@ -24,18 +25,22 @@ (define-module (gnu packages elm) #:use-module (gnu packages haskell-xyz) #:use-module (gnu packages haskell-web) #:use-module (guix build-system haskell) + #:use-module (guix gexp) #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages)) -;; The full elm build calls out to itself via Template Haskell to -;; compile the elm reactor web app. elm reactor isn't required to -;; compile elm applications, so we take this part out of this -;; bootstrap package. +;; The `elm` build usually calls out to itself via Template Haskell to compile +;; the `elm reactor` web app (which depends on additional Elm packages) and +;; embeds the static files into itself. The reactor isn't required to compile +;; elm applications, so we want to skip it from the bootstrap package, but we +;; also want to be able to enable it once we can build it. We patch Elm to +;; instead look for the files on disk relative to the executable and exit with +;; a useful error message if they aren't there. (define-public elm-compiler (package (name "elm-compiler") - (version "0.19.0") + (version "0.19.1") (source (origin (method git-fetch) @@ -44,24 +49,29 @@ (define-public elm-compiler (url "https://github.com/elm/compiler/") (commit version))) (sha256 - (base32 "0s93z9vr0vp5w894ghc5s34nsq09sg1msf59zfiba87sid5vgjqy")) + (base32 "1rdg3xp3js9xadclk3cdypkscm5wahgsfmm4ldcw3xswzhw6ri8w")) (patches - (search-patches "elm-compiler-disable-reactor.patch" - "elm-compiler-fix-map-key.patch")))) + (search-patches "elm-reactor-static-files.patch")))) (build-system haskell-build-system) (arguments - `(#:phases - (modify-phases %standard-phases - (add-before 'configure 'update-constraints - (lambda _ - (substitute* "elm.cabal" - (("(ansi-terminal|containers|network|http-client|language-glsl)\\s+[^,]+" all dep) - dep))))))) + (list + #:configure-flags + #~(list (string-append "--ghc-option=-DGUIX_REACTOR_STATIC_REL_ROOT=" + "\"../share/elm/reactor-" + #$(package-version this-package) + "\"")) + #:phases + #~(modify-phases %standard-phases + (add-before 'configure 'update-constraints + (lambda _ + (substitute* "elm.cabal" + (("(ansi-terminal|containers|network|http-client|language-glsl)\\s+[^,]+" all dep) + dep))))))) (inputs (list ghc-ansi-terminal ghc-ansi-wl-pprint ghc-edit-distance - ghc-file-embed + ghc-filelock ghc-http ghc-http-client ghc-http-client-tls diff --git a/gnu/packages/patches/elm-compiler-disable-reactor.patch b/gnu/packages/patches/elm-compiler-disable-reactor.patch deleted file mode 100644 index 9871b55e8d..0000000000 --- a/gnu/packages/patches/elm-compiler-disable-reactor.patch +++ /dev/null @@ -1,71 +0,0 @@ -commit 20d80e2323b565a36751c9455e535d8f73fa32f7 -Author: Robert Vollmert -Date: Fri Jun 14 16:05:47 2019 +0200 - - disable reactor - -diff --git a/elm.cabal b/elm.cabal -index c75f9689..ece63c46 100644 ---- a/elm.cabal -+++ b/elm.cabal -@@ -45,9 +45,6 @@ Executable elm - builder/src - ui/terminal/src - -- other-extensions: -- TemplateHaskell -- - Main-Is: - Main.hs - -@@ -56,8 +53,6 @@ Executable elm - Develop - Develop.Generate.Help - Develop.Generate.Index -- Develop.StaticFiles -- Develop.StaticFiles.Build - Diff - Init - Install -diff --git a/ui/terminal/src/Develop.hs b/ui/terminal/src/Develop.hs -index 4b2252e1..7ed7716e 100644 ---- a/ui/terminal/src/Develop.hs -+++ b/ui/terminal/src/Develop.hs -@@ -23,7 +23,6 @@ import Snap.Util.FileServe - import qualified Elm.Project as Project - import qualified Develop.Generate.Help as Generate - import qualified Develop.Generate.Index as Index --import qualified Develop.StaticFiles as StaticFiles - import qualified Generate.Output as Output - import qualified Json.Encode as Encode - import qualified Reporting.Exit as Exit -@@ -219,16 +218,7 @@ compileToHtmlBuilder mode file = - - - serveAssets :: Snap () --serveAssets = -- do file <- getSafePath -- case StaticFiles.lookup file of -- Nothing -> -- pass -- -- Just (content, mimeType) -> -- do modifyResponse (setContentType (mimeType <> ";charset=utf-8")) -- writeBS content -- -+serveAssets = pass - - - -- MIME TYPES -diff --git a/ui/terminal/src/Main.hs b/terminal/src/Main.hs -index 7000f3ca..2c76965a 100644 ---- a/ui/terminal/src/Main.hs -+++ b/ui/terminal/src/Main.hs -@@ -39,7 +39,6 @@ main = - complex intro outro - [ repl - , init -- , reactor - , make - , install - , bump diff --git a/gnu/packages/patches/elm-compiler-fix-map-key.patch b/gnu/packages/patches/elm-compiler-fix-map-key.patch deleted file mode 100644 index 4f05ded530..0000000000 --- a/gnu/packages/patches/elm-compiler-fix-map-key.patch +++ /dev/null @@ -1,38 +0,0 @@ -commit e3512d887df41a8162c3e361171c04beca08415b -Author: Tom Stejskal -Date: Mon Nov 19 20:09:43 2018 +0100 - - Fix Map.!: given key is not an element in the map - -diff --git a/compiler/src/Elm/Compiler/Type/Extract.hs b/compiler/src/Elm/Compiler/Type/Extract.hs -index 1aafe1d4..99763392 100644 ---- a/compiler/src/Elm/Compiler/Type/Extract.hs -+++ b/compiler/src/Elm/Compiler/Type/Extract.hs -@@ -10,6 +10,7 @@ module Elm.Compiler.Type.Extract - - - import Data.Map ((!)) -+import qualified Data.Map as Map - import qualified Data.Maybe as Maybe - import qualified Data.Set as Set - -@@ -134,11 +135,15 @@ extractUnion interfaces (Opt.Global home name) = - else - let - pname = toPublicName home name -- unions = I._unions (interfaces ! home) -+ maybeUnions = I._unions <$> Map.lookup home interfaces - in -- case I.toUnionInternals (unions ! name) of -- Can.Union vars ctors _ _ -> -- T.Union pname vars <$> traverse extractCtor ctors -+ case Map.lookup name =<< maybeUnions of -+ Just union -> -+ case I.toUnionInternals union of -+ Can.Union vars ctors _ _ -> -+ T.Union pname vars <$> traverse extractCtor ctors -+ Nothing -> -+ return $ T.Union pname [] [] - - - extractCtor :: Can.Ctor -> Extractor (N.Name, [T.Type]) diff --git a/gnu/packages/patches/elm-reactor-static-files.patch b/gnu/packages/patches/elm-reactor-static-files.patch new file mode 100644 index 0000000000..94c4aa0cd1 --- /dev/null +++ b/gnu/packages/patches/elm-reactor-static-files.patch @@ -0,0 +1,251 @@ +From 41d219a29b03f3114af7a0521c8b2dbbb487c3e1 Mon Sep 17 00:00:00 2001 +From: Philip McGrath +Date: Wed, 13 Apr 2022 18:45:58 -0400 +Subject: [PATCH] reactor: look for static files relative to executable + +Must built with `-DGUIX_REACTOR_STATIC_REL_ROOT="../path/to/reactor"`. + +This lets us build a version of Elm without the `elm reactor` for +bootstrapping, then simply put the files in place in the final package. +--- + elm.cabal | 2 +- + terminal/src/Develop.hs | 32 +++++++++++---- + terminal/src/Develop/StaticFiles.hs | 37 ++++++++++------- + terminal/src/Develop/StaticFiles/Build.hs | 50 ++++++++++++++--------- + 4 files changed, 79 insertions(+), 42 deletions(-) + +diff --git a/elm.cabal b/elm.cabal +index bf1cfcf0..93161072 100644 +--- a/elm.cabal ++++ b/elm.cabal +@@ -50,6 +50,7 @@ Executable elm + + other-extensions: + TemplateHaskell ++ CPP + + Main-Is: + Main.hs +@@ -211,7 +212,6 @@ Executable elm + containers >= 0.5.8.2 && < 0.6, + directory >= 1.2.3.0 && < 2.0, + edit-distance >= 0.2 && < 0.3, +- file-embed, + filelock, + filepath >= 1 && < 2.0, + ghc-prim >= 0.5.2, +diff --git a/terminal/src/Develop.hs b/terminal/src/Develop.hs +index 00339364..6855b03e 100644 +--- a/terminal/src/Develop.hs ++++ b/terminal/src/Develop.hs +@@ -33,6 +33,7 @@ import qualified Reporting.Exit as Exit + import qualified Reporting.Task as Task + import qualified Stuff + ++import System.Exit as SysExit + + + -- RUN THE DEV SERVER +@@ -45,13 +46,29 @@ data Flags = + + + run :: () -> Flags -> IO () +-run () (Flags maybePort) = ++run () flags = do ++ frontEnd <- StaticFiles.prepare ++ case frontEnd of ++ Right lookup -> ++ reallyRun lookup flags ++ Left missing -> ++ SysExit.die $ unlines ++ [ "The `reactor` command is not available." ++ , "" ++ , "On Guix, these files are needed for `elm reactor` to work," ++ , "but they are missing:" ++ , "" ++ , unlines (map (\pth -> " " ++ (show pth)) missing) ++ ] ++ ++reallyRun :: StaticFiles.Lookup -> Flags -> IO () ++reallyRun lookup (Flags maybePort) = + do let port = maybe 8000 id maybePort + putStrLn $ "Go to http://localhost:" ++ show port ++ " to see your project dashboard." + httpServe (config port) $ + serveFiles + <|> serveDirectoryWith directoryConfig "." +- <|> serveAssets ++ <|> serveAssets lookup + <|> error404 + + +@@ -169,16 +186,15 @@ compile path = + -- SERVE STATIC ASSETS + + +-serveAssets :: Snap () +-serveAssets = ++serveAssets :: StaticFiles.Lookup -> Snap () ++serveAssets lookup = + do path <- getSafePath +- case StaticFiles.lookup path of ++ case lookup path of + Nothing -> + pass + +- Just (content, mimeType) -> +- do modifyResponse (setContentType (mimeType <> ";charset=utf-8")) +- writeBS content ++ Just (fsPath, mimeType) -> ++ serveFileAs (mimeType <> ";charset=utf-8") fsPath + + + +diff --git a/terminal/src/Develop/StaticFiles.hs b/terminal/src/Develop/StaticFiles.hs +index 94ee72dc..3227d617 100644 +--- a/terminal/src/Develop/StaticFiles.hs ++++ b/terminal/src/Develop/StaticFiles.hs +@@ -2,7 +2,8 @@ + {-# LANGUAGE OverloadedStrings #-} + {-# LANGUAGE TemplateHaskell #-} + module Develop.StaticFiles +- ( lookup ++ ( prepare ++ , Lookup + , cssPath + , elmPath + , waitingPath +@@ -11,9 +12,7 @@ module Develop.StaticFiles + + import Prelude hiding (lookup) + import qualified Data.ByteString as BS +-import Data.FileEmbed (bsToExp) + import qualified Data.HashMap.Strict as HM +-import Language.Haskell.TH (runIO) + import System.FilePath (()) + + import qualified Develop.StaticFiles.Build as Build +@@ -26,20 +25,29 @@ import qualified Develop.StaticFiles.Build as Build + type MimeType = + BS.ByteString + ++type Lookup = FilePath -> Maybe (FilePath, MimeType) + +-lookup :: FilePath -> Maybe (BS.ByteString, MimeType) +-lookup path = ++prepare :: IO (Either [FilePath] Lookup) ++prepare = do ++ found <- Build.findReactorFrontEnd expectedFiles ++ return $ case found of ++ Left missing -> ++ Left missing ++ Right resolved -> ++ Right (mkLookup (HM.fromList resolved)) ++ ++mkLookup :: HM.HashMap FilePath (FilePath, MimeType) -> Lookup ++mkLookup dict path = + HM.lookup path dict + + +-dict :: HM.HashMap FilePath (BS.ByteString, MimeType) +-dict = +- HM.fromList +- [ faviconPath ==> (favicon , "image/x-icon") +- , elmPath ==> (elm , "application/javascript") +- , cssPath ==> (css , "text/css") +- , codeFontPath ==> (codeFont, "font/ttf") +- , sansFontPath ==> (sansFont, "font/ttf") ++expectedFiles :: [(FilePath, MimeType)] ++expectedFiles = ++ [ faviconPath ==> "image/x-icon" ++ , elmPath ==> "application/javascript" ++ , cssPath ==> "text/css" ++ , codeFontPath ==> "font/ttf" ++ , sansFontPath ==> "font/ttf" + ] + + +@@ -82,7 +90,7 @@ sansFontPath = + "_elm" "source-sans-pro.ttf" + + +- ++{- + -- ELM + + +@@ -121,3 +129,4 @@ sansFont = + favicon :: BS.ByteString + favicon = + $(bsToExp =<< runIO (Build.readAsset "favicon.ico")) ++-} +diff --git a/terminal/src/Develop/StaticFiles/Build.hs b/terminal/src/Develop/StaticFiles/Build.hs +index c61fae57..c39b08b0 100644 +--- a/terminal/src/Develop/StaticFiles/Build.hs ++++ b/terminal/src/Develop/StaticFiles/Build.hs +@@ -1,28 +1,39 @@ + {-# LANGUAGE OverloadedStrings #-} ++{-# LANGUAGE CPP #-} + module Develop.StaticFiles.Build +- ( readAsset +- , buildReactorFrontEnd ++ ( findReactorFrontEnd + ) + where + +- +-import qualified Data.ByteString as BS +-import qualified Data.ByteString.Builder as B +-import qualified Data.ByteString.Lazy as LBS +-import qualified Data.NonEmptyList as NE + import qualified System.Directory as Dir +-import System.FilePath (()) +- +-import qualified BackgroundWriter as BW +-import qualified Build +-import qualified Elm.Details as Details +-import qualified Generate +-import qualified Reporting +-import qualified Reporting.Exit as Exit +-import qualified Reporting.Task as Task +- +- +- ++import System.FilePath ((), takeDirectory) ++import System.Environment (getExecutablePath) ++import Data.Either as Either ++ ++reactorStaticRelRoot :: FilePath ++reactorStaticRelRoot = GUIX_REACTOR_STATIC_REL_ROOT ++ ++type Resolved a = (FilePath, (FilePath, a)) ++ ++findReactorFrontEnd :: [(FilePath, a)] -> IO (Either [FilePath] [Resolved a]) ++findReactorFrontEnd specs = do ++ exe <- getExecutablePath ++ let dir = takeDirectory exe reactorStaticRelRoot ++ dirExists <- Dir.doesDirectoryExist dir ++ files <- sequence (map (findFile dir) specs) ++ return $ case Either.lefts files of ++ [] -> ++ Right (Either.rights files) ++ missing -> ++ Left $ if dirExists then missing else [dir] ++ ++findFile :: FilePath -> (FilePath, a) -> IO (Either FilePath (Resolved a)) ++findFile dir (rel, rhs) = do ++ let abs = dir rel ++ exists <- Dir.doesFileExist abs ++ return $ if not exists then Left abs else Right (rel, (abs, rhs)) ++ ++{- + -- ASSETS + + +@@ -71,3 +82,4 @@ runTaskUnsafe task = + \\nCompile with `elm make` directly to figure it out faster\ + \\n--------------------------------------------------------\ + \\n" ++-} +-- +2.32.0 +