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

Add an unsnoc function to unpack the right side of an Adjoined.

This commit is contained in:
Rob Rix 2016-03-11 18:40:45 -05:00
parent 004236acdb
commit 115549407c

View File

@ -16,6 +16,10 @@ uncons :: Adjoined a -> Maybe (a, Adjoined a)
uncons (Adjoined v) | a :< as <- viewl v = Just (a, Adjoined as)
| otherwise = Nothing
unsnoc :: Adjoined a -> Maybe (Adjoined a, a)
unsnoc (Adjoined v) | as :> a <- viewr v = Just (Adjoined as, a)
| otherwise = Nothing
instance Applicative Adjoined where
pure = return
(<*>) = ap