diff --git a/src/Source.hs b/src/Source.hs index f7581544e..b70d07577 100644 --- a/src/Source.hs +++ b/src/Source.hs @@ -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)