Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix example code in the tutorial #2100

Merged
merged 3 commits into from
Dec 4, 2020
Merged

Fix example code in the tutorial #2100

merged 3 commits into from
Dec 4, 2020

Conversation

jeremyschlatter
Copy link
Contributor

No description provided.

- `Dhall.expected resultDecoder` is a `Validation Expected TypeErrors (Expr Src Void)`,
  not a `Expr Src Void`. `maximum` is a terse way of extracting the
  `Expr Src Void` or crashing in the error case. (And in this example,
  it is never the error case.)

- ++ works for String, but not Data.Text. Use the Semigroup instance
  instead.
@jeremyschlatter
Copy link
Contributor Author

The changes here allowed me to compile and run the example Haskell code. The code does not seem to work as described, though. In particular this claim

Now we can omit the definition of Result in our example.dhall file. While this will work perfectly...

seems to be false. When I change example.dhall to be

-- example.dhall

Result.Failure +1

and then parse it with

Dhall.input (Dhall.auto :: Dhall.Decoder Result) ("let Result = " <> Data.Text.pack resultTypeString <> " in ./example.dhall")

I get this failure:

main: 
↳ ./example.dhall

Error: Unbound variable: Result

Copy link
Collaborator

@Gabriella439 Gabriella439 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeremyschlatter: Yeah, that part of the documentation is incorrect. Bound variables are not forwarded to transitive imports. Would you like to also delete that part as part of this pull request?

@Gabriella439 Gabriella439 merged commit 95ba4e8 into dhall-lang:master Dec 4, 2020
@jeremyschlatter jeremyschlatter deleted the tutorial-fix branch March 23, 2022 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants