Fix build and warnings

This commit is contained in:
Julian Ospald 2020-01-31 23:25:14 +01:00
parent 68b5be3edf
commit b031456619
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28
2 changed files with 11 additions and 17 deletions

View File

@ -1,7 +1,6 @@
module Main where module Main where
import Control.Error.Util import Control.Error.Util
import Control.Monad
import Control.Monad.Except import Control.Monad.Except
import Control.Monad.Reader import Control.Monad.Reader
import Data.ByteString ( ByteString ) import Data.ByteString ( ByteString )
@ -11,24 +10,19 @@ import Data.Dates ( getCurrentDateTime
, DateTime(..) , DateTime(..)
) )
import Data.Functor ( (<&>) ) import Data.Functor ( (<&>) )
import Data.List
import Data.Maybe import Data.Maybe
import Data.Semigroup ( (<>) ) import Data.Semigroup ( (<>) )
import qualified Data.Text as T import qualified Data.Text as T
import Data.Time.Calendar import Data.Time.Calendar
import Data.Time.Clock import Data.Time.Clock
import Data.Time.Clock.POSIX
import Data.Time.Format import Data.Time.Format
import Data.Time.Format.ISO8601 import Data.Time.Format.ISO8601
import GHup import GHup
import GitHub.Auth import GitHub.Auth
import GitHub.Data.Definitions
import GitHub.Data.Name
import GitHub.Data.Repos import GitHub.Data.Repos
import GitHub.Data.URL import GitHub.Data.URL
import HPath import HPath
import Options.Applicative import Options.Applicative
import Safe
import System.Console.Pretty import System.Console.Pretty
import System.Exit import System.Exit
import Text.Layout.Table import Text.Layout.Table
@ -126,14 +120,14 @@ main :: IO ()
main = do main = do
-- wrapper to run effects with settings -- wrapper to run effects with settings
let run e = do let run e = do
settings <- exceptT settings <- exceptT
(\_ -> die (\_ -> die
. color Red . color Red
$ "Could not get settings, make sure to run 'ghup config' first" $ "Could not get settings, make sure to run 'ghup config' first"
) )
pure pure
$ getSettings $ getSettings
(flip runReaderT) settings . runExceptT . withExceptT show $ e (flip runReaderT) settings . runExceptT . withExceptT show $ e
e <- execParser (info (opts <**> helper) idm) >>= \case e <- execParser (info (opts <**> helper) idm) >>= \case
-- fork -- fork
@ -155,10 +149,10 @@ main = do
-- list-forks -- list-forks
ListForks (ListForkOptions {..}) -> run $ do ListForks (ListForkOptions {..}) -> run $ do
mtime <- liftIO $ case lSince of mtime <- liftIO $ case lSince of
Just t -> do Just t' -> do
dt <- getCurrentDateTime dt <- getCurrentDateTime
let mt = let mt =
either (const Nothing) Just . parseDate dt . UTF8.toString $ t either (const Nothing) Just . parseDate dt . UTF8.toString $ t'
pure $ mt >>= \t -> pure $ mt >>= \t ->
(parseTimeM (parseTimeM
True True

View File

@ -54,12 +54,12 @@ executable ghup
, mtl ^>= 2.2 , mtl ^>= 2.2
, optparse-applicative ^>= 0.15 , optparse-applicative ^>= 0.15
, pretty-terminal ^>= 0.1 , pretty-terminal ^>= 0.1
, safe ^>= 0.3
, table-layout ^>= 0.8 , table-layout ^>= 0.8
, text ^>= 1.2 , text ^>= 1.2
, time ^>= 1.9 , time ^>= 1.9
, utf8-string ^>= 1.0 , utf8-string ^>= 1.0
hs-source-dirs: app hs-source-dirs: app
ghc-options: -Wall
default-language: Haskell2010 default-language: Haskell2010
default-extensions: LambdaCase, MultiWayIf, RecordWildCards, TupleSections default-extensions: LambdaCase, MultiWayIf, RecordWildCards, TupleSections