-
Notifications
You must be signed in to change notification settings - Fork 105
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
How are you meant to "re-scope" an env? #75
Comments
A bit of an update after bashing on this for a while: from what I can tell, scopes are treated like a set, but they are order dependent. What I did was write a So going forward:
|
I ran into this problem as well. For example, when downloading and uploading a bytestring in the same function, the constraints become :
I believe getting rid of type-level lists and declaring distinct constraints for each API scope ( |
I've got a module in my project that's the single interface to all of my usage of google cloud services. Currently, each individual function is rebuilding the
env
each time, which seems pretty wasteful. I would rather the user be able to pass in an env to each function.The problem comes with the scopes needed for each function:
The problem with 1 is if one of my google functions uses multiple google functions internally, the required type signature does not seem to concatenate lists but forces me to specify them individually, duplicates and all. So if I use
foo
which requires'[a, b, c]
andbar
which requires'[b, c, d]
, thenfooBar
's constraints won't require(HasScope s '[a, b, c, d] ~ True) => Env s -> ...
but rather(HasScope s '[a, b, c] ~ True, HasScope s '[b, c, d]) => Env s -> ...
, which can get really repetitive the more you use. I am not willing to forgo writing type signatures for toplevel functions.The problem with 2 is
envScopes :: Lens' a (Proxy s)
uses aLens'
which does not allow type-changing, so I cannot do something likelet env' = env & envScopes .~ neededScopes
because that changess
and that lens will not allow it.I tried to look at the examples for guidance but because they set up the env and set scopes in one shot, they can't really model the scenario of the user passing in an env to something that demands a certain set of scopes. What should I do?
The text was updated successfully, but these errors were encountered: