diff options
-rw-r--r-- | Codec/MIME/Parse.hs | 4 | ||||
-rw-r--r-- | Notmuch/Message.hs | 1 | ||||
-rw-r--r-- | RenderTreeView.hs | 18 | ||||
-rw-r--r-- | Trammel.hs | 4 | ||||
-rw-r--r-- | common.nix | 5 | ||||
-rw-r--r-- | env.nix | 4 | ||||
-rw-r--r-- | install.nix | 8 | ||||
-rw-r--r-- | much.cabal | 40 | ||||
-rw-r--r-- | nix/email-header.nix | 4 | ||||
-rw-r--r-- | test5.hs | 6 |
10 files changed, 53 insertions, 41 deletions
diff --git a/Codec/MIME/Parse.hs b/Codec/MIME/Parse.hs index 803e4b2..221def0 100644 --- a/Codec/MIME/Parse.hs +++ b/Codec/MIME/Parse.hs @@ -107,7 +107,7 @@ normalizeCRLF t | T.null t = "" | "\r\n" `T.isPrefixOf` t = "\r\n" <> normalizeCRLF (T.drop 2 t) | any (`T.isPrefixOf` t) ["\r", "\n"] = "\r\n" <> normalizeCRLF (T.drop 1 t) - | otherwise = let (a,b) = T.break (`elem` "\r\n") t in a <> normalizeCRLF b + | otherwise = let (a,b) = T.break (`elem` ("\r\n" :: String)) t in a <> normalizeCRLF b parseMIMEMessage :: T.Text -> MIMEValue parseMIMEMessage entity = @@ -263,7 +263,7 @@ isHSpace :: Char -> Bool isHSpace c = c == ' ' || c == '\t' isTSpecial :: Char -> Bool -isTSpecial x = x `elem` "()<>@,;:\\\"/[]?=" -- " +isTSpecial x = x `elem` ("()<>@,;:\\\"/[]?=" :: String) -- " dropFoldingWSP :: T.Text -> T.Text dropFoldingWSP t | T.null t = "" diff --git a/Notmuch/Message.hs b/Notmuch/Message.hs index 8c3d1ed..cdfaf9c 100644 --- a/Notmuch/Message.hs +++ b/Notmuch/Message.hs @@ -1,4 +1,5 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE OverloadedStrings #-} module Notmuch.Message where diff --git a/RenderTreeView.hs b/RenderTreeView.hs index 3926282..a50bf37 100644 --- a/RenderTreeView.hs +++ b/RenderTreeView.hs @@ -25,20 +25,22 @@ import TreeView humanTimeLocale :: HumanTimeLocale humanTimeLocale = defaultHumanTimeLocale { justNow = "now" - , secondsAgo = (++ "s ago") - , oneMinuteAgo = "1m ago" - , minutesAgo = (++ "m ago") - , oneHourAgo = "1h ago" - , aboutHoursAgo = (++ "h ago") + , secondsAgo = \f -> (++ "s" ++ dir f) + , oneMinuteAgo = \f -> "1m" ++ dir f + , minutesAgo = \f -> (++ "m" ++ dir f) + , oneHourAgo = \f -> "1h" ++ dir f + , aboutHoursAgo = \f -> (++ "h" ++ dir f) , at = \_ -> ("" ++) - , daysAgo = (++ "d ago") - , weekAgo = (++ "w ago") - , weeksAgo = (++ "w ago") + , daysAgo = \f -> (++ "d" ++ dir f) + , weekAgo = \f -> (++ "w" ++ dir f) + , weeksAgo = \f -> (++ "w" ++ dir f) , onYear = ("" ++) , dayOfWeekFmt = "%a %H:%M" , thisYearFmt = "%b %e" , prevYearFmt = "%b %e, %Y" } + where dir True = " from now" + dir False = " ago" renderTreeView @@ -97,7 +97,7 @@ instance IsPm Bold where toPm NoBold = [22] fromPm = rec . filterPm sgrColor where - rec xs = case filter (`elem`[1,22]) xs of + rec xs = case filter (`elem` ([1,22] :: [Int])) xs of [] -> Nothing xs' -> case last xs' of 1 -> Just Bold @@ -113,7 +113,7 @@ instance IsPm Underline where toPm NoUnderline = [24] fromPm = rec . filterPm sgrColor where - rec xs = case filter (`elem`[4,24]) xs of + rec xs = case filter (`elem` ([4,24] :: [Int])) xs of [] -> Nothing xs' -> case last xs' of 1 -> Just Underline diff --git a/common.nix b/common.nix new file mode 100644 index 0000000..9590572 --- /dev/null +++ b/common.nix @@ -0,0 +1,5 @@ +{ + haskell-overrides = self: super: { + email-header = self.callPackage ./nix/email-header.nix {}; + }; +} @@ -38,9 +38,7 @@ let ); hsPkgs = pkgs.haskellngPackages.override { - overrides = self: super: with self; { - email-header = callPackage ./nix/email-header.nix {}; - }; + overrides = (import ./common.nix).haskell-overrides; }; pkgs = nixpkgs // staticPkgs; diff --git a/install.nix b/install.nix index 1af984c..3b5f3f8 100644 --- a/install.nix +++ b/install.nix @@ -2,4 +2,10 @@ , target }: -nixpkgs.pkgs.haskellngPackages.callPackage target {} +let + hspkgs = nixpkgs.pkgs.haskellngPackages.override { + overrides = (import ./common.nix).haskell-overrides; + }; +in + +hspkgs.callPackage target {} @@ -8,34 +8,34 @@ cabal-version: >=1.10 executable much main-is: test5.hs - build-depends: base >=4.7 && <4.8 - , aeson >=0.8 && <0.9 + build-depends: base + , aeson , attoparsec , base64-bytestring , blaze-builder - , bytestring >=0.10 && <0.11 - , case-insensitive >=1.2 && <1.3 - , containers >=0.5 && <0.6 - , deepseq >=1.3 && <1.4 - , directory >=1.2 && <1.3 - , docopt >=0.6 && <0.7 + , bytestring + , case-insensitive + , containers + , deepseq + , directory + , docopt , email-header , filepath - , friendly-time >=0.3 && <0.4 - , hyphenation >=0.4 && < 0.5 - , linebreak >=1.0 && <1.1 + , friendly-time + , hyphenation + , linebreak , old-locale - , process >=1.2 && <1.3 + , process , random - , rosezipper >=0.2 && <0.3 + , rosezipper , safe - , split >=0.2 && <0.3 - , terminal-size >= 0.3 && <0.4 - , text >=1.2 && <1.3 - , time >=1.4 && <1.5 + , split + , terminal-size + , text + , time , transformers - , transformers-compat >=0.4 - , unix >=2.7 && <2.8 - , vector >=0.10 && <0.11 + , transformers-compat + , unix + , vector default-language: Haskell2010 ghc-options: -O2 -Wall -threaded diff --git a/nix/email-header.nix b/nix/email-header.nix index a6caea2..8c62f2f 100644 --- a/nix/email-header.nix +++ b/nix/email-header.nix @@ -7,8 +7,8 @@ mkDerivation { version = "0.3.0"; src = fetchgit { url = "https://github.com/4z3/email-header"; - sha256 = "f8e77302594d8ff163a5df75dd886f9932ef9d1a084f79c0393b48fcb2a51eb4"; - rev = "3ba16e71cf1fff92fd86199f893d89a40ca1275d"; + sha256 = "f33fba567a39b1f2448869b269c26c40d8007599c23ab83bde5b4dfd9fd76ebc"; + rev = "7b179bd31192ead8afe7a0b6e34bcad4039deaa8"; }; buildDepends = [ attoparsec base base64-bytestring bytestring case-insensitive @@ -35,11 +35,10 @@ import RenderTreeView (renderTreeView) import Scanner (scan) import Safe import System.Directory -import System.Console.Docopt (getArgWithDefault, optionsWithUsage, shortOption) +import System.Console.Docopt.NoTH (getArgWithDefault, parseArgsOrExit, parseUsageOrExit, shortOption) import System.Environment import System.Exit import System.IO -import System.Locale (defaultTimeLocale, rfc822DateFormat) import System.Posix.Signals import System.Process import TagUtils @@ -115,7 +114,8 @@ main = mainWithArgs :: [String] -> IO () mainWithArgs args = do - args' <- optionsWithUsage usage args + usage' <- parseUsageOrExit usage + args' <- parseArgsOrExit usage' args let query = getArgWithDefault args' defaultSearch (shortOption 'q') bracket (initState query) cleanup startup where |