-
Notifications
You must be signed in to change notification settings - Fork 211
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
Implementation of toMap #1041
Implementation of toMap #1041
Conversation
Could you please remove the unrelated changes you accidentally included in the PR? That would make merging much easier. In particular, why did you add the edit: Never mind, the commit history tells the story here. |
This reverts commit b5bdbab.
…to blamario-master
@blamario: If you merge blamario#1 into your branch then this should be ready to merge |
I have merged it, but |
Did you |
That was it, thanks! All tests are passing now. |
@blamario: Thank you so much for all the work you put into this! 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit late to the party – I'll address these myself.
@@ -527,6 +528,15 @@ eval !env t = | |||
| Just f <- Dhall.Map.lookup k m -> maybe f (vApp f) mt | |||
| otherwise -> error errorMsg | |||
(x, y, ma) -> VMerge x y ma | |||
ToMap x ma -> case (evalE x, evalE <$> ma) of | |||
(VRecordLit m, Just (VList t)) | null m -> | |||
VListLit (Just t) (Dhall.Map.foldMapWithKey entry m) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we know that m
is empty:
VListLit (Just t) (Dhall.Map.foldMapWithKey entry m) | |
VListLit (Just t) Data.Sequence.empty |
(VRecordLit m, Just (VList t)) | null m -> | ||
VListLit (Just t) (Dhall.Map.foldMapWithKey entry m) | ||
(VRecordLit m, _) -> | ||
VListLit Nothing (Dhall.Map.foldMapWithKey entry m) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mconcat
ting a singleton for each element seems fairly inefficient to me. I suspect it would be better to do something like
Data.Sequence.fromList . ... . Dhall.Map.toList
) | ||
) | ||
|
||
let keyValues = Dhall.Map.foldMapWithKey entry kvsX |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
…addressing my own comments on #1041.
…addressing my own comments on #1041.
I believe I'm done. A dhall-lang PR with tests will follow.