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 normalization of partially-saturated folds #47

Merged
merged 1 commit into from
Apr 20, 2020

Conversation

travisbrown
Copy link
Owner

Noticed a couple of minor bugs while putting together a PR to remove this code, which was a temporary fix to emulate a bug in the Haskell implementation.

I don't want to actually remove this code until there's a new dhall-haskell release with the fix there, so I'm fixing the bug here for now.

The issue is pretty minor, and I think should only affect cases where you try to type-check a normalized expression with a partially-applied fold:

scala> import org.dhallj.syntax._
import org.dhallj.syntax._

scala> "List/fold Natural [1] Natural".parseExpr.flatMap(_.normalize.typeCheck)
res0: scala.util.Either[org.dhallj.core.DhallException,org.dhallj.core.Expr] = Left(org.dhallj.core.typechecking.TypeCheckFailure: Can't apply Natural)

After this change:

scala> import org.dhallj.syntax._
import org.dhallj.syntax._

scala> "List/fold Natural [1] Natural".parseExpr.flatMap(_.normalize.typeCheck)
res0: scala.util.Either[org.dhallj.core.DhallException,org.dhallj.core.Expr] = Right(∀(cons : (Natural  Natural  Natural))  ∀(nil : Natural)  Natural)

Thankfully this whole terrible hack will be gone soon!

@travisbrown
Copy link
Owner Author

Not sure what's going on with Travis CI, which seems even more broken than usual today, but this build passed.

@travisbrown travisbrown merged commit d8b0093 into master Apr 20, 2020
@travisbrown travisbrown deleted the topic/fix-partially-saturated-folds branch April 20, 2020 12:04
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.

1 participant