You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's currently error-prone to use statics and I've made this mistake several times:
data Static = X | Y
resource :: Resource WithA WithB Ident Void Static
resource = mkResourceReader
{ R.name = "foo"
, R.schema = noListing $ named
[ ("id" , singleRead ById )
, ( "x" , static X )
]
, R.get = Just get
, R.statics = \case
X -> x
Y -> y
}
This is missing a route to Y so this end point will be inaccessible and you won't get a warning.
Actions and selects do not have this problem since they don't require entries in both schema and actions.
Is there a reason statics are handled differently? Could we remove statics from schema and change the type of statics to [(String, Handler)]?
The text was updated successfully, but these errors were encountered:
This is a broader problem, you can have the same with normal getters and listings. One issue I can think of with moving the statics outside of the schema is that it would be much easier to accidentally create overlapping schemas, where a static and a getter/list use the same key name.
It's currently error-prone to use statics and I've made this mistake several times:
This is missing a route to
Y
so this end point will be inaccessible and you won't get a warning.Actions and selects do not have this problem since they don't require entries in both
schema
andactions
.Is there a reason statics are handled differently? Could we remove statics from
schema
and change the type of statics to[(String, Handler)]
?The text was updated successfully, but these errors were encountered: