From bfd854e05207a073eaa983c49f27c37555ccfce5 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 26 Jun 2015 23:02:09 +0200 Subject: bump compatibility to nixos-15.06pre64030.e1af50c --- Codec/MIME/Parse.hs | 4 ++-- Notmuch/Message.hs | 1 + RenderTreeView.hs | 18 ++++++++++-------- Trammel.hs | 4 ++-- common.nix | 5 +++++ env.nix | 4 +--- install.nix | 8 +++++++- much.cabal | 40 ++++++++++++++++++++-------------------- nix/email-header.nix | 4 ++-- test5.hs | 6 +++--- 10 files changed, 53 insertions(+), 41 deletions(-) create mode 100644 common.nix 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 diff --git a/Trammel.hs b/Trammel.hs index d83b846..d1abedb 100644 --- a/Trammel.hs +++ b/Trammel.hs @@ -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 {}; + }; +} diff --git a/env.nix b/env.nix index 78ea95e..7f5a9bc 100644 --- a/env.nix +++ b/env.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 {} diff --git a/much.cabal b/much.cabal index 8934f2a..5f0bf0f 100644 --- a/much.cabal +++ b/much.cabal @@ -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 diff --git a/test5.hs b/test5.hs index 2fc7f09..6ef1494 100644 --- a/test5.hs +++ b/test5.hs @@ -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 -- cgit v1.2.3