diff --git a/dhall/src/Dhall/Freeze.hs b/dhall/src/Dhall/Freeze.hs index b6546d029..54809f398 100644 --- a/dhall/src/Dhall/Freeze.hs +++ b/dhall/src/Dhall/Freeze.hs @@ -253,6 +253,12 @@ freezeExpression -> IO (Expr s Import) freezeExpression = freezeExpressionWithManager Dhall.Import.defaultNewManager +-- https://github.com/dhall-lang/dhall-haskell/issues/2347 +toMissing :: Import -> Import +toMissing import_ = + import_ { importHashed = (importHashed import_) { importType = Missing } } + + -- | See 'freezeExpression'. freezeExpressionWithManager :: IO Dhall.Import.Manager @@ -315,17 +321,21 @@ freezeExpressionWithManager newManager directory scope intent expression = do (Embed import_@(Import { importHashed = ImportHashed { hash = Nothing } })) = do frozenImport <- freezeFunction import_ + let frozenMissing = toMissing frozenImport + {- The two imports can be the same if the import is local and `freezeFunction` only freezes remote imports by default -} if frozenImport /= import_ - then return (ImportAlt (Embed frozenImport) (Embed import_)) + then return (ImportAlt (Embed frozenMissing) (Embed import_)) else return (Embed import_) cache (Embed import_@(Import { importHashed = ImportHashed { hash = Just _ } })) = do -- Regenerate the integrity check, just in case it's wrong frozenImport <- freezeFunction import_ + let frozenMissing = toMissing frozenImport + -- `dhall freeze --cache` also works the other way around, adding an -- unprotected fallback import to imports that are already -- protected @@ -335,7 +345,7 @@ freezeExpressionWithManager newManager directory scope intent expression = do } } - return (ImportAlt (Embed frozenImport) (Embed thawedImport)) + return (ImportAlt (Embed frozenMissing) (Embed thawedImport)) cache expression_ = return expression_ diff --git a/dhall/tests/freeze/cachedB.dhall b/dhall/tests/freeze/cachedB.dhall index f76294595..44af7a6ce 100644 --- a/dhall/tests/freeze/cachedB.dhall +++ b/dhall/tests/freeze/cachedB.dhall @@ -1,3 +1,3 @@ - ./True.dhall + missing sha256:27abdeddfe8503496adeb623466caa47da5f63abd2bc6fa19f6cfcb73ecfed70 ? ./True.dhall diff --git a/dhall/tests/freeze/incorrectHashB.dhall b/dhall/tests/freeze/incorrectHashB.dhall index f76294595..44af7a6ce 100644 --- a/dhall/tests/freeze/incorrectHashB.dhall +++ b/dhall/tests/freeze/incorrectHashB.dhall @@ -1,3 +1,3 @@ - ./True.dhall + missing sha256:27abdeddfe8503496adeb623466caa47da5f63abd2bc6fa19f6cfcb73ecfed70 ? ./True.dhall diff --git a/dhall/tests/freeze/protectedB.dhall b/dhall/tests/freeze/protectedB.dhall index f76294595..44af7a6ce 100644 --- a/dhall/tests/freeze/protectedB.dhall +++ b/dhall/tests/freeze/protectedB.dhall @@ -1,3 +1,3 @@ - ./True.dhall + missing sha256:27abdeddfe8503496adeb623466caa47da5f63abd2bc6fa19f6cfcb73ecfed70 ? ./True.dhall diff --git a/dhall/tests/freeze/unprotectedB.dhall b/dhall/tests/freeze/unprotectedB.dhall index f76294595..44af7a6ce 100644 --- a/dhall/tests/freeze/unprotectedB.dhall +++ b/dhall/tests/freeze/unprotectedB.dhall @@ -1,3 +1,3 @@ - ./True.dhall + missing sha256:27abdeddfe8503496adeb623466caa47da5f63abd2bc6fa19f6cfcb73ecfed70 ? ./True.dhall diff --git a/stack.yaml b/stack.yaml index 4381d124f..316c83a5d 100644 --- a/stack.yaml +++ b/stack.yaml @@ -24,3 +24,7 @@ nix: packages: - ncurses - zlib +flags: + # https://github.com/RyanGlScott/mintty/issues/4 + mintty: + Win32-2-13-1: false