mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-01 12:41:52 -07:00
X.P.OrgMode: Remove pLast
Use the more aptly named `option` instead.
This commit is contained in:
@@ -414,7 +414,7 @@ pInput inp = (`runParser` inp) . choice $
|
|||||||
|
|
||||||
-- | Parse a 'Priority'.
|
-- | Parse a 'Priority'.
|
||||||
pPriority :: Parser Priority
|
pPriority :: Parser Priority
|
||||||
pPriority = pLast (pure NoPriority) $
|
pPriority = option NoPriority $
|
||||||
" " *> skipSpaces *> choice
|
" " *> skipSpaces *> choice
|
||||||
[ "#" *> ("A" <|> "a") $> A
|
[ "#" *> ("A" <|> "a") $> A
|
||||||
, "#" *> ("B" <|> "b") $> B
|
, "#" *> ("B" <|> "b") $> B
|
||||||
@@ -423,7 +423,7 @@ pPriority = pLast (pure NoPriority) $
|
|||||||
|
|
||||||
-- | Try to parse a 'Time'.
|
-- | Try to parse a 'Time'.
|
||||||
pTimeOfDay :: Parser (Maybe TimeOfDay)
|
pTimeOfDay :: Parser (Maybe TimeOfDay)
|
||||||
pTimeOfDay = pLast (pure Nothing) $
|
pTimeOfDay = option Nothing $
|
||||||
skipSpaces *> choice
|
skipSpaces *> choice
|
||||||
[ Just <$> (TimeOfDay <$> pHour <* string ":" <*> pMinute) -- HH:MM
|
[ Just <$> (TimeOfDay <$> pHour <* string ":" <*> pMinute) -- HH:MM
|
||||||
, Just <$> (TimeOfDay <$> pHour <*> pure 0 ) -- HH
|
, Just <$> (TimeOfDay <$> pHour <*> pure 0 ) -- HH
|
||||||
@@ -485,8 +485,3 @@ pNumBetween lo hi = do
|
|||||||
n <- num
|
n <- num
|
||||||
n <$ guard (n >= lo && n <= hi)
|
n <$ guard (n >= lo && n <= hi)
|
||||||
|
|
||||||
-- | A flipped version of '(<|>)'. Useful when @p'@ is some complicated
|
|
||||||
-- expression that, for example, consumes spaces and @p@ does not want
|
|
||||||
-- to do that.
|
|
||||||
pLast :: Parser a -> Parser a -> Parser a
|
|
||||||
pLast p p' = p' <|> p
|
|
||||||
|
Reference in New Issue
Block a user