File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -319,9 +319,23 @@ instance RecApplicative rs => RecApplicative (r ': rs) where
319319 rpure s = s :& rpure s
320320 {-# INLINE rpure #-}
321321
322- -- | A record may be traversed with respect to its interpretation functor. This
323- -- can be used to yank (some or all) effects from the fields of the record to
324- -- the outside of the record.
322+ {- |
323+ A record may be traversed with respect to its interpretation functor. This
324+ can be used to yank (some or all) effects from the fields of the record to
325+ the outside of the record.
326+
327+ >>> import Data.Vinyl.Functor (Identity(Identity))
328+ >>> testRec :: Rec Maybe '[String, Double, Int] = Just "Ho" :& Just 3.0 :& Nothing :& RNil
329+ >>>
330+ :{
331+ ext :: Maybe x -> Maybe (Identity x)
332+ ext (Just x) = Just (Identity x)
333+ ext Nothing = Nothing
334+ :}
335+ >>> rtraverse ext testRec
336+ Nothing
337+ -}
338+
325339rtraverse
326340 :: Applicative h
327341 => (forall x . f x -> h (g x ))
You can’t perform that action at this time.
0 commit comments