git.iko.soy/typeable/swagger2
on master help sign in
Use lenses everywhere in Data.Swagger.Schema.Internal
commitfe42795e1db7e7f7e2229d1c2ab9f771d1e3ae74 authorNickolay Kudasov <nickolay.kudasov@gmail.com> dateMon 23 Nov 2015, 18:54 (11 years ago) parent0703c19
1 file changed+7−8
src/Data/Swagger/Schema/Internal.hs+7−8
src/Data/Swagger/Schema/Internal.hs+7−8
@@ -34,18 +34,17 @@ class GToSchema (f :: * -> *) where
3434
3535instance {-# OVERLAPPABLE #-} ToSchema a => ToSchema [a] where
3636 toSchema _ = mempty
37− { _schemaType = SchemaArray
38− , _schemaItems = Just (SchemaItemsObject (Inline (toSchema (Proxy :: Proxy a))))
39− }
37+ & schemaType .~ SchemaArray
38+ & schemaItems ?~ SchemaItemsObject (Inline (toSchema (Proxy :: Proxy a)))
4039
4140instance {-# OVERLAPPING #-} ToSchema String where
42− toSchema _ = mempty { _schemaType = SchemaString }
41+ toSchema _ = mempty & schemaType .~ SchemaString
4342
4443instance ToSchema Bool where
45− toSchema _ = mempty { _schemaType = SchemaBoolean }
44+ toSchema _ = mempty & schemaType .~ SchemaBoolean
4645
4746instance ToSchema Integer where
48− toSchema _ = mempty { _schemaType = SchemaInteger }
47+ toSchema _ = mempty & schemaType .~ SchemaInteger
4948
5049instance ToSchema Int where toSchema = toSchemaBoundedIntegral
5150instance ToSchema Int8 where toSchema = toSchemaBoundedIntegral
@@ -60,10 +59,10 @@ instance ToSchema Word32 where toSchema = toSchemaBoundedIntegral
6059instance ToSchema Word64 where toSchema = toSchemaBoundedIntegral
6160
6261instance ToSchema Double where
63− toSchema _ = mempty { _schemaType = SchemaNumber }
62+ toSchema _ = mempty & schemaType .~ SchemaNumber
6463
6564instance ToSchema Float where
66− toSchema _ = mempty { _schemaType = SchemaNumber }
65+ toSchema _ = mempty & schemaType .~ SchemaNumber
6766
6867instance ToSchema a => ToSchema (Maybe a) where
6968 toSchema _ = toSchema (Proxy :: Proxy a)