@@ -198,29 +198,31 @@ instance forall m. (Applicative m) => HasResolver m Bool where
198198 resolve handler Nothing = map (ok . toValue) handler
199199 resolve _ (Just ss) = throwE (SubSelectionOnLeaf ss)
200200
201- -- XXX: jml really doesn't understand this. What happens to the selection set? What if it's a nullable object?
202- instance forall m hg . (HasResolver m hg , Functor m , ToValue (Maybe hg )) => HasResolver m (Maybe hg ) where
203- type Handler m (Maybe hg ) = m (Maybe hg )
204- resolve handler _ = map (ok . toValue) handler
205-
206201instance forall m hg . (Monad m , Applicative m , HasResolver m hg ) => HasResolver m (API. List hg ) where
207202 type Handler m (API. List hg ) = m [Handler m hg ]
208203 resolve handler selectionSet = do
209204 h <- handler
210205 let a = traverse (flip (resolve @ m @ hg ) selectionSet) h
211206 map aggregateResults a
212207
213-
214208instance forall m ksN enum . (Applicative m , API. GraphQLEnum enum ) => HasResolver m (API. Enum ksN enum ) where
215209 type Handler m (API. Enum ksN enum ) = enum
216210 resolve handler Nothing = (pure . ok . GValue. ValueEnum . API. enumToValue) handler
217211 resolve _ (Just ss) = throwE (SubSelectionOnLeaf ss)
218212
213+ -- TODO: This is our handler for `Maybe a`, which is currently used to
214+ -- implement nullable types. It's *probably* broken, in that it's discarding
215+ -- the selection set. <https://github.com/jml/graphql-api/issues/102>
216+ instance forall m hg . (HasResolver m hg , Functor m , ToValue (Maybe hg )) => HasResolver m (Maybe hg ) where
217+ type Handler m (Maybe hg ) = m (Maybe hg )
218+ resolve handler _ = map (ok . toValue) handler
219+
219220-- TODO: A parametrized `Result` is really not a good way to handle the
220221-- "result" for resolveField, but not sure what to use either. Tom liked the
221222-- tuple we had before more because it didn't imply any other structure or
222223-- meaning. Maybe we can just create a new datatype. jml thinks we should
223224-- extract some helpful generic monad, ala `Validator`.
225+ -- <https://github.com/jml/graphql-api/issues/98>
224226type ResolveFieldResult = Result (Maybe GValue. Value )
225227
226228-- Extract field name from an argument type. TODO: ideally we'd run
0 commit comments