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:
parent
004236acdb
commit
115549407c
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user