biocad / openapi3

OpenAPI 3.0 data model
BSD 3-Clause "New" or "Revised" License
39 stars 54 forks source link

Add `hoistDeclare` #22

Open masaeedu opened 3 years ago

masaeedu commented 3 years ago

As an example, this lets us lift:

declareSchema :: ToSchema a => Proxy a -> Declare (Definitions Schema) Schema 

into:

declareSchema' :: ToSchema a => Proxy a -> Declare Components Schema 
declareSchema' = hoistDeclareT schemas . declareSchema
dylex commented 2 years ago

I also found this useful. To be consistent with Lens, this should maybe be called zoomDeclare.

(To be honest, at the end of the day I ended up just switching to MonadState since it's more flexible and efficient, and has a bunch more functionality available.)