git.iko.soy/typeable/openapi3
on master help sign in
Fix GHC 8 build by manually writing out SwaggerItems prisms
commitcd3dc81eaf271d0625dbf67831a913ac2bee2768 authorNickolay Kudasov <nickolay.kudasov@gmail.com> dateMon 18 Jan 2016, 22:56 (11 years ago) parent7587044
1 file changed+20−1
src/Data/Swagger/Lens.hs+20−1
src/Data/Swagger/Lens.hs+20−1
@@ -2,6 +2,7 @@
22{-# LANGUAGE FunctionalDependencies #-}
33{-# LANGUAGE GADTs #-}
44{-# LANGUAGE MultiParamTypeClasses #-}
5+{-# LANGUAGE RankNTypes #-}
56{-# LANGUAGE TemplateHaskell #-}
67module Data.Swagger.Lens where
78
@@ -42,8 +43,26 @@ makeLenses ''ParamOtherSchema
4243makeLenses ''Header
4344-- ** 'Schema' lenses
4445makeLenses ''Schema
46+
4547-- ** 'SwaggerItems' prisms
46−makePrisms ''SwaggerItems
48+
49+_SwaggerItemsArray :: forall t. (t ~ Schema) => Review (SwaggerItems t) [Referenced Schema]
50+_SwaggerItemsArray
51+ = prism (\x -> SwaggerItemsArray x) $ \x -> case x of
52+ SwaggerItemsPrimitive c p -> Left (SwaggerItemsPrimitive c p)
53+ SwaggerItemsObject o -> Left (SwaggerItemsObject o)
54+ SwaggerItemsArray a -> Right a
55+
56+_SwaggerItemsObject :: forall t. (t ~ Schema) => Review (SwaggerItems t) (Referenced Schema)
57+_SwaggerItemsObject
58+ = prism (\x -> SwaggerItemsObject x) $ \x -> case x of
59+ SwaggerItemsPrimitive c p -> Left (SwaggerItemsPrimitive c p)
60+ SwaggerItemsObject o -> Right o
61+ SwaggerItemsArray a -> Left (SwaggerItemsArray a)
62+
63+_SwaggerItemsPrimitive :: forall t p f. (Profunctor p, Bifunctor p, Functor f) => Optic' p f (SwaggerItems t) (Maybe (CollectionFormat t), ParamSchema t)
64+_SwaggerItemsPrimitive = unto (\(c, p) -> SwaggerItemsPrimitive c p)
65+
4766-- ** 'ParamSchema' lenses
4867makeLenses ''ParamSchema
4968-- ** 'Xml' lenses