remove *>=> and >=*> ; use <$$> instead
I forgot I had <$$> hidden away in Utility.Applicative. It allows doing the same kind of currying as does >=*> and I found using it made the code more readable for me. (*>=> was not used)
This commit is contained in:
parent
c6032b0dab
commit
57d49a6d04
6 changed files with 7 additions and 18 deletions
|
@ -293,10 +293,9 @@ withKeysReferencedInGitRef a ref = do
|
||||||
forM_ ts $ tKey lookAtWorkingTree >=> maybe noop a
|
forM_ ts $ tKey lookAtWorkingTree >=> maybe noop a
|
||||||
liftIO $ void clean
|
liftIO $ void clean
|
||||||
where
|
where
|
||||||
tKey True = Backend.lookupFile . DiffTree.file >=*>
|
tKey True = fmap fst <$$> Backend.lookupFile . DiffTree.file
|
||||||
fmap fst
|
tKey False = fileKey . takeFileName . encodeW8 . L.unpack <$$>
|
||||||
tKey False = catFile ref . DiffTree.file >=*>
|
catFile ref . DiffTree.file
|
||||||
fileKey . takeFileName . encodeW8 . L.unpack
|
|
||||||
|
|
||||||
{- Looks in the specified directory for bad/tmp keys, and returns a list
|
{- Looks in the specified directory for bad/tmp keys, and returns a list
|
||||||
- of those that might still have value, or might be stale and removable.
|
- of those that might still have value, or might be stale and removable.
|
||||||
|
|
|
@ -102,7 +102,7 @@ updateEncryptedCipher newkeys encipher@(EncryptedCipher _ variant (KeyIds ks)) =
|
||||||
cipher <- decryptCipher encipher
|
cipher <- decryptCipher encipher
|
||||||
encryptCipher cipher variant $ KeyIds ks'
|
encryptCipher cipher variant $ KeyIds ks'
|
||||||
where
|
where
|
||||||
listKeyIds = mapM (Gpg.findPubKeys >=*> keyIds) >=*> concat
|
listKeyIds = concat <$$> mapM (keyIds <$$> Gpg.findPubKeys)
|
||||||
|
|
||||||
describeCipher :: StorableCipher -> String
|
describeCipher :: StorableCipher -> String
|
||||||
describeCipher (SharedCipher _) = "shared cipher"
|
describeCipher (SharedCipher _) = "shared cipher"
|
||||||
|
|
|
@ -103,7 +103,7 @@ stagedDetails' ps l repo = do
|
||||||
where
|
where
|
||||||
(metadata, file) = separate (== '\t') s
|
(metadata, file) = separate (== '\t') s
|
||||||
(mode, rest) = separate (== ' ') metadata
|
(mode, rest) = separate (== ' ') metadata
|
||||||
readmode = headMaybe . readOct >=*> fst
|
readmode = fst <$$> headMaybe . readOct
|
||||||
|
|
||||||
{- Returns a list of the files in the specified locations that are staged
|
{- Returns a list of the files in the specified locations that are staged
|
||||||
- for commit, and whose type has changed. -}
|
- for commit, and whose type has changed. -}
|
||||||
|
|
|
@ -71,7 +71,7 @@ parseTransitionLine s = TransitionLine <$> pdate ds <*> readish ts
|
||||||
ws = words s
|
ws = words s
|
||||||
ts = Prelude.head ws
|
ts = Prelude.head ws
|
||||||
ds = unwords $ Prelude.tail ws
|
ds = unwords $ Prelude.tail ws
|
||||||
pdate = parseTime defaultTimeLocale "%s%Qs" >=*> utcTimeToPOSIXSeconds
|
pdate = utcTimeToPOSIXSeconds <$$> parseTime defaultTimeLocale "%s%Qs"
|
||||||
|
|
||||||
combineTransitions :: [Transitions] -> Transitions
|
combineTransitions :: [Transitions] -> Transitions
|
||||||
combineTransitions = S.unions
|
combineTransitions = S.unions
|
||||||
|
|
|
@ -369,7 +369,7 @@ checkGpgPackets keys str = do
|
||||||
(Just (KeyIds ks), ls, []) -> do
|
(Just (KeyIds ks), ls, []) -> do
|
||||||
-- Find the master key associated with the
|
-- Find the master key associated with the
|
||||||
-- encryption subkey.
|
-- encryption subkey.
|
||||||
ks' <- concat <$> mapM (findPubKeys >=*> keyIds)
|
ks' <- concat <$> mapM (keyIds <$$> findPubKeys)
|
||||||
[ k | k:"keyid":_ <- map (reverse . words) ls ]
|
[ k | k:"keyid":_ <- map (reverse . words) ls ]
|
||||||
return $ sort (nub ks) == sort (nub ks')
|
return $ sort (nub ks) == sort (nub ks')
|
||||||
_ -> return False
|
_ -> return False
|
||||||
|
|
|
@ -53,16 +53,6 @@ ma <&&> mb = ifM ma ( mb , return False )
|
||||||
infixr 3 <&&>
|
infixr 3 <&&>
|
||||||
infixr 2 <||>
|
infixr 2 <||>
|
||||||
|
|
||||||
{- Left-to-right Kleisli composition with a pure left/right hand side. -}
|
|
||||||
(*>=>) :: Monad m => (a -> b) -> (b -> m c) -> (a -> m c)
|
|
||||||
f *>=> g = return . f >=> g
|
|
||||||
|
|
||||||
(>=*>) :: Monad m => (a -> m b) -> (b -> c) -> (a -> m c)
|
|
||||||
f >=*> g = f >=> return . g
|
|
||||||
|
|
||||||
{- Same fixity as >=> and <=< -}
|
|
||||||
infixr 1 *>=>, >=*>
|
|
||||||
|
|
||||||
{- Runs an action, passing its value to an observer before returning it. -}
|
{- Runs an action, passing its value to an observer before returning it. -}
|
||||||
observe :: Monad m => (a -> m b) -> m a -> m a
|
observe :: Monad m => (a -> m b) -> m a -> m a
|
||||||
observe observer a = do
|
observe observer a = do
|
||||||
|
|
Loading…
Reference in a new issue