Add Interpret
/Inject
instances for []
This commit is contained in:
parent
fa51d5e40e
commit
27264a0ba4
|
@ -455,6 +455,9 @@ instance Interpret a => Interpret (Maybe a) where
|
|||
instance Interpret a => Interpret (Vector a) where
|
||||
autoWith opts = vector (autoWith opts)
|
||||
|
||||
instance Interpret a => Interpret [a] where
|
||||
autoWith = fmap (fmap Data.Vector.toList) autoWith
|
||||
|
||||
instance (Interpret a, Interpret b) => Interpret (a, b) where
|
||||
autoWith = fmap (\R2{..} -> (_1, _2)) . autoWith
|
||||
|
||||
|
@ -743,6 +746,9 @@ instance Inject a => Inject (Vector a) where
|
|||
|
||||
InputType embedIn declaredIn = injectWith options
|
||||
|
||||
instance Inject a => Inject [a] where
|
||||
injectWith = fmap (contramap Data.Vector.fromList) injectWith
|
||||
|
||||
-- | (a, b) is mapped to { _1 = a, _2 = b }
|
||||
instance (Inject a, Inject b) => Inject (a, b) where
|
||||
injectWith = fmap (contramap adapt) injectWith
|
||||
|
|
Loading…
Reference in New Issue
Block a user