add dropFromEnd

This commit is contained in:
Joey Hess 2018-11-23 11:24:05 -04:00
parent acb4bcf2db
commit 850d19d038
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 10 additions and 6 deletions

View file

@ -30,6 +30,7 @@ import Utility.Data
import Utility.PartialPrelude
import Utility.Misc
import Utility.Tuple
import Utility.Split
import Data.List
import Data.Time.Clock
@ -265,7 +266,7 @@ toRecurrance s = case words s of
constructor "month" = Just Monthly
constructor "year" = Just Yearly
constructor u
| "s" `isSuffixOf` u = constructor $ reverse $ drop 1 $ reverse u
| "s" `isSuffixOf` u = constructor $ dropFromEnd 1 u
| otherwise = Nothing
withday sd u = do
c <- constructor u