1
1
mirror of https://github.com/github/semantic.git synced 2024-11-25 11:04:00 +03:00

cons over Source.

This commit is contained in:
Rob Rix 2015-12-23 23:06:49 -05:00
parent f89b05bb41
commit b6e05008ec

View File

@ -24,5 +24,8 @@ at = (!!) . unSource
null :: Source a -> Bool
null (Source vector) = Vector.null vector
cons :: a -> Source a -> Source a
cons a = Source . Vector.cons a . getVector
uncons :: Source a -> Maybe (a, Source a)
uncons (Source vector) = if Vector.null vector then Nothing else Just (Vector.head vector, Source $ Vector.tail vector)