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

Add API to destructure a Source.

This commit is contained in:
Rob Rix 2015-12-23 23:05:01 -05:00
parent 08122476e6
commit ee91b130e4

View File

@ -23,3 +23,6 @@ at = (!!) . unSource
null :: Source a -> Bool
null (Source vector) = Vector.null vector
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)