>>> cons a [] [a]
>>> cons a [b, c] [a,b,c]
>>> cons a (Seq.fromList []) fromList [a]
>>> cons a (Seq.fromList [b, c]) fromList [a,b,c]
cons 't' "est" == "test" \x xs -> uncons (cons x xs) == Just (x,xs)
toNonEmpty (cons x xs) = cons x (toNonEmpty xs)
cons a stream = yield a >> streamUseful for interoperation:
Data.Text.foldr S.cons (return ()) :: Text -> Stream (Of Char) m () Lazy.foldrChunks S.cons (return ()) :: Lazy.ByteString -> Stream (Of Strict.ByteString) m ()and so on.
> 4 `cons` [1,2,3] [4,1,2,3]