@@ -81,13 +81,24 @@ class AsType a s where
82 _Typed :: Prism' s a
82 _Typed :: Prism' s a
85+ injectTyped :: a -> s
88+ projectTyped :: s -> Maybe a
85 ( Generic s
91 ( Generic s
86 , ErrorUnlessOne a s (CountPartialType a (Rep s))
92 , ErrorUnlessOne a s (CountPartialType a (Rep s))
87 , GAsType (Rep s) a
93 , GAsType (Rep s) a
88 ) => AsType a s where
94 ) => AsType a s where
90− _Typed = repIso . _GTyped
97+ = repIso . _GTyped
101+ = either (const Nothing) Just . gprojectTyped . from
92type family ErrorUnlessOne (a :: Type) (s :: Type) (count :: Count) :: Constraint where
103type family ErrorUnlessOne (a :: Type) (s :: Type) (count :: Count) :: Constraint where
93 ErrorUnlessOne a s 'None
104 ErrorUnlessOne a s 'None