Skip to content

Commit

Permalink
Remove dependency on bitraverse
Browse files Browse the repository at this point in the history
  • Loading branch information
psibi committed Jul 28, 2018
1 parent dad5745 commit b94db07
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 3 additions & 4 deletions XMonad/Util/Brightness.hs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -70,11 +70,9 @@ module XMonad.Util.Brightness
import XMonad import XMonad
#if (MIN_VERSION_base(4,10,0)) #if (MIN_VERSION_base(4,10,0))
import Data.Traversable (traverse) import Data.Traversable (traverse)
#else
import Prelude (traverse)
#endif #endif
import Prelude
import System.IO (hPutStrLn, stderr) import System.IO (hPutStrLn, stderr)
import Data.Bitraversable (bitraverse)
import Control.Monad (join) import Control.Monad (join)
import Data.Bifunctor (first) import Data.Bifunctor (first)
import Control.Exception (try) import Control.Exception (try)
Expand Down Expand Up @@ -126,7 +124,8 @@ readInt str = case (reads (unpack str)) of
_ -> Left "Could not parse string to int" _ -> Left "Could not parse string to int"


printError :: Either String e -> IO (Either () e) printError :: Either String e -> IO (Either () e)
printError = bitraverse (hPutStrLn stderr) (pure . id) printError es = either (\str -> hPutStrLn stderr str *> (return . Left $ ())) (\_ -> return . Left $ ()) es



getFromFile :: FilePath -> (BS.ByteString -> Either String a) -> IO (Either String a) getFromFile :: FilePath -> (BS.ByteString -> Either String a) -> IO (Either String a)
getFromFile filename fcast = fmap (fcast =<<) (try' $ BS.readFile filename) getFromFile filename fcast = fmap (fcast =<<) (try' $ BS.readFile filename)
Expand Down
2 changes: 0 additions & 2 deletions stack.yaml
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,3 @@


resolver: lts-11.16 resolver: lts-11.16


extra-deps: extra-deps:
Expand Down

0 comments on commit b94db07

Please sign in to comment.