:: x -> (x, x) -package:monoid-subclasses

Duplicate a single value into a pair.
dupe 12 == (12, 12)
Construct a pair by duplication of a single value
Known as dup in the Arrow literature.
Creates a tuple by pairing something with itself.
>>> dup "foo"
("foo","foo")

>>> dup ()
((),())
Duplicate an input.
\x -> (x::Rational) == (uncurry (+) $ mapFst fromInteger $ splitFraction x)
\x -> uncurry (==) $ mapFst (((x::Double)-) . fromInteger) $ splitFraction x
\x -> uncurry (==) $ mapFst (((x::Rational)-) . fromInteger) $ splitFraction x
\x -> splitFraction x == (floor (x::Double) :: Integer, fraction x)
\x -> splitFraction x == (floor (x::Rational) :: Integer, fraction x)
RealRing.genericSplitFraction =~= (NP.splitFraction :: Double -> (Integer,Double))
RealRing.genericSplitFraction =~= (NP.splitFraction :: Rational -> (Integer,Rational))
Attempt to extract the left-most element from a container, and a version of the container without that element.
>>> uncons []
Nothing
>>> uncons [a, b, c]
Just (a,[b,c])
Attempt to extract the left-most element from a container, and a version of the container without that element.
>>> uncons []
Nothing
>>> uncons [1, 2, 3]
Just (1,[2,3])
Attempt to extract the right-most element from a container, and a version of the container without that element.
>>> unsnoc (LazyT.pack "hello!")
Just ("hello",'!')
>>> unsnoc (LazyT.pack "")
Nothing
>>> unsnoc (Seq.fromList [b,c,a])
Just (fromList [b,c],a)
>>> unsnoc (Seq.fromList [])
Nothing
Attempt to extract the right-most element from a container, and a version of the container without that element.
>>> unsnoc "hello!"
Just ("hello",'!')
>>> unsnoc ""
Nothing
Extract head and tail, return Nothing if empty