move stripbrackets to Utils
This commit is contained in:
parent
e3d5fdde66
commit
157c85a915
@ -58,6 +58,8 @@ strip = lstrip . rstrip
|
|||||||
lstrip = dropWhile (`elem` " \t") :: String -> String
|
lstrip = dropWhile (`elem` " \t") :: String -> String
|
||||||
rstrip = reverse . lstrip . reverse
|
rstrip = reverse . lstrip . reverse
|
||||||
|
|
||||||
|
stripbrackets = dropWhile (`elem` "([") . reverse . dropWhile (`elem` "])") . reverse
|
||||||
|
|
||||||
elideLeft width s =
|
elideLeft width s =
|
||||||
if length s > width then ".." ++ reverse (take (width - 2) $ reverse s) else s
|
if length s > width then ".." ++ reverse (take (width - 2) $ reverse s) else s
|
||||||
|
|
||||||
@ -445,4 +447,3 @@ expandPath curdir p = (if isRelative p then (curdir </>) else id) `liftM` expand
|
|||||||
firstJust ms = case dropWhile (==Nothing) ms of
|
firstJust ms = case dropWhile (==Nothing) ms of
|
||||||
[] -> Nothing
|
[] -> Nothing
|
||||||
(md:_) -> md
|
(md:_) -> md
|
||||||
|
|
||||||
|
|||||||
@ -174,7 +174,6 @@ getPostings st enteredps = do
|
|||||||
postingtype ('[':_) = BalancedVirtualPosting
|
postingtype ('[':_) = BalancedVirtualPosting
|
||||||
postingtype ('(':_) = VirtualPosting
|
postingtype ('(':_) = VirtualPosting
|
||||||
postingtype _ = RegularPosting
|
postingtype _ = RegularPosting
|
||||||
stripbrackets = dropWhile (`elem` "([") . reverse . dropWhile (`elem` "])") . reverse
|
|
||||||
validateamount = Just $ \s -> (null s && not (null enteredrealps))
|
validateamount = Just $ \s -> (null s && not (null enteredrealps))
|
||||||
|| isRight (runParser (amountp >> many spacenonewline >> eof) ctx "" s)
|
|| isRight (runParser (amountp >> many spacenonewline >> eof) ctx "" s)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user