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:
Joey Hess 2013-09-27 19:58:48 -04:00
parent c6032b0dab
commit 57d49a6d04
6 changed files with 7 additions and 18 deletions

View file

@ -293,10 +293,9 @@ withKeysReferencedInGitRef a ref = do
forM_ ts $ tKey lookAtWorkingTree >=> maybe noop a
liftIO $ void clean
where
tKey True = Backend.lookupFile . DiffTree.file >=*>
fmap fst
tKey False = catFile ref . DiffTree.file >=*>
fileKey . takeFileName . encodeW8 . L.unpack
tKey True = fmap fst <$$> Backend.lookupFile . DiffTree.file
tKey False = fileKey . takeFileName . encodeW8 . L.unpack <$$>
catFile ref . DiffTree.file
{- 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.

View file

@ -102,7 +102,7 @@ updateEncryptedCipher newkeys encipher@(EncryptedCipher _ variant (KeyIds ks)) =
cipher <- decryptCipher encipher
encryptCipher cipher variant $ KeyIds ks'
where
listKeyIds = mapM (Gpg.findPubKeys >=*> keyIds) >=*> concat
listKeyIds = concat <$$> mapM (keyIds <$$> Gpg.findPubKeys)
describeCipher :: StorableCipher -> String
describeCipher (SharedCipher _) = "shared cipher"

View file

@ -103,7 +103,7 @@ stagedDetails' ps l repo = do
where
(metadata, file) = separate (== '\t') s
(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
- for commit, and whose type has changed. -}

View file

@ -71,7 +71,7 @@ parseTransitionLine s = TransitionLine <$> pdate ds <*> readish ts
ws = words s
ts = Prelude.head ws
ds = unwords $ Prelude.tail ws
pdate = parseTime defaultTimeLocale "%s%Qs" >=*> utcTimeToPOSIXSeconds
pdate = utcTimeToPOSIXSeconds <$$> parseTime defaultTimeLocale "%s%Qs"
combineTransitions :: [Transitions] -> Transitions
combineTransitions = S.unions

View file

@ -369,7 +369,7 @@ checkGpgPackets keys str = do
(Just (KeyIds ks), ls, []) -> do
-- Find the master key associated with the
-- encryption subkey.
ks' <- concat <$> mapM (findPubKeys >=*> keyIds)
ks' <- concat <$> mapM (keyIds <$$> findPubKeys)
[ k | k:"keyid":_ <- map (reverse . words) ls ]
return $ sort (nub ks) == sort (nub ks')
_ -> return False

View file

@ -53,16 +53,6 @@ ma <&&> mb = ifM ma ( mb , return False )
infixr 3 <&&>
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. -}
observe :: Monad m => (a -> m b) -> m a -> m a
observe observer a = do