second -package:universum
Send the second component of the input through the argument arrow, and
copy the rest unchanged to the output.
The default definition may be overridden with a more efficient version
if desired.
d ╭─────╮ d
>───┼─────┼───>
>───┼─ f ─┼───>
b ╰─────╯ c
Map covariantly over the second argument.
second ≡ bimap id
Examples
>>> second (+1) ('j', 3)
('j',4)
>>> second (+1) (Right 3)
Right 4
Update the second component of a pair.
second reverse (1,"test") == (1,"tset")
Second, without decimal part, 00 - 60.
Access to the second value of a pair.
A
Timespan representing a single second.
A mirror image of
first.
The default definition may be overridden with a more efficient version
if desired.
Supply the second component of the tuple to an unfold that accepts a
tuple as a seed resulting in a fold that accepts the first component
of the tuple as a seed.
second b = Unfold.lmap (, b)
Pre-release
Map over the right side of an
Either
>>> let f = uninterpret "f" :: SInteger -> SInteger
>>> prove $ \x -> second f (sRight x :: SEither Integer Integer) .== sRight (f x)
Q.E.D.
>>> prove $ \x -> second f (sLeft x :: SEither Integer Integer) .== sLeft x
Q.E.D.
A mirror image of
first.
The default definition may be overridden with a more efficient version
if desired.
This parser will match a two-digit number in the range (0,60) and
return its integer value.
>>> parseTest second "34"
34
Lens focusing on the second element of a product
Applies a function to the second element of a pair. Often known on the
wild as
mapSnd.
> second (*100) (1,2)
(1,200)