dhall-lang / dhall-haskell

Maintainable configuration files
https://dhall-lang.org/
BSD 3-Clause "New" or "Revised" License
912 stars 213 forks source link

`as Location` doesn't return `Missing` #2477

Closed mode89 closed 1 year ago

mode89 commented 1 year ago

Hi there :)

When doing the following:

let someLocation = "/some/missing/file" as Location

the value saved in someLocation is always Local "/some/missing/file". Shouldn't it be Missing when the file doesn't exist?

I ran this code on dhall of version 1.41.1.

MonoidMusician commented 1 year ago

The Missing value of Location represents the missing keyword, which is an import that always fails in Dhall. The as Location import is not meant to represent the state of your filesystem at the time you run Dhall.

Gabriella439 commented 1 year ago

Basically, as Location doesn't actually perform any IO. It just reifies within the language what Dhall would have resolved

mode89 commented 1 year ago

Oh, I see. Thank you for the explanation :)