Skip to content

safe document conversions + fix $operators #39

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

Merged
merged 1 commit into from
Mar 22, 2012

Conversation

deian
Copy link
Member

@deian deian commented Mar 22, 2012

safe document conversions + fix $operators
addressed issue #38

@@ -116,7 +121,7 @@ valueAt k = runIdentity . look k

-- | Typed value of field in document. Error if missing or wrong type.
at :: forall v l. (Val l v, Label l) => Key -> Document l -> v
at k doc = maybe err id (lookup k doc)
at k doc = fromMaybe err (lookup k doc)
Copy link
Member

Choose a reason for hiding this comment

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

God I wish I knew about fromMaybe....

@alevy
Copy link
Member

alevy commented Mar 22, 2012

I'm happy with this for now. I think this means you can't do, e.g. range queries over searchable fields (which in principal is safe), but I'm happier being over-careful in this case and keeping the complexity of code changes to a minimum at this point. I don't think range queries are a must-have right now at all.

alevy added a commit that referenced this pull request Mar 22, 2012
safe document conversions + fix $operators
@alevy alevy merged commit a29ad5f into scslab:master Mar 22, 2012
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.

2 participants