packages feed

lambdabot-utils 4.2.1 → 4.2.2

raw patch · 8 files changed

+72/−34 lines, 8 filesnew-uploaderPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Lambdabot.Signals: instance Exception SignalException
+ Lambdabot.Signals: instance Show SignalException

Files

Lambdabot/AltTime.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-orphans #-} -- | Time compatibility layer module Lambdabot.AltTime (     ClockTime,@@ -91,5 +92,3 @@                 se <- get                 ps <- get                 return (TimeDiff ye mo da ho mi se ps)--
Lambdabot/Error.hs view
@@ -56,7 +56,7 @@              -> m b -- ^ Guard              -> m a -- ^ Returns: A new monad. finallyError m after = do a <- catchError m (\e -> after >> throwError e)-                          after+                          _ <- after                           return a  -- | 'bracketError' is the monadic version of DYNAMIC-WIND from Scheme
Lambdabot/Parser.hs view
@@ -21,6 +21,7 @@             -> Right $ fixPrecedence $ unparen e         ParseFailed (SrcLoc _ _ col) msg             -> Left $ showParseError msg (col - length prefix) s+        _ -> Left $ "Unexpected result of parsing an expression"   where     prefix  = "module Main where { main = ("     wrapped = prefix ++ s ++ "\n)}"@@ -64,6 +65,7 @@ parseDecl s = case parseModule s of         ParseOk (HsModule _ _ _ _ [d])   -> Right $ fixPrecedence d         ParseFailed (SrcLoc _ _ col) msg -> Left $ showParseError msg col s+        _                                -> Left $ "Unexpected result of parsing a declaration"  showParseError :: String -> Int -> String -> String showParseError msg col s = " " ++ msg
Lambdabot/Pointful.hs view
@@ -24,6 +24,7 @@ pVarsIn h = everything (++) (mkQ [] (\x -> case x of HsPVar name -> [name]; _ -> [])) h  succName (HsIdent s) = HsIdent . reverse . succAlpha . reverse $ s+succName _ = error "HsIdent expected"  succAlpha ('z':xs) = 'a' : succAlpha xs succAlpha (x  :xs) = succ x : xs@@ -127,6 +128,7 @@           f@(ParseFailed _ _) -> error ("Combinator loading: " ++ show f)         declToTuple (HsPatBind _ (HsPVar fname) (HsUnGuardedRhs body) [])           = (UnQual fname, HsParen body)+        declToTuple _ = error "Can't conver declaration to tuple: incorrect pattern bindings"  -- the names we recognize as combinators, so we don't generate them as temporaries then substitute them. -- TODO: more generally correct would be to not substitute any variable which is bound by a pattern
Lambdabot/Process.hs view
@@ -8,7 +8,6 @@ import System.IO import System.Process import Control.Concurrent       (forkIO, newEmptyMVar, putMVar, takeMVar, killThread)-import Control.Monad import qualified Control.Exception as E  run :: FilePath -> String -> (String -> String) -> IO String@@ -33,13 +32,13 @@       -> Maybe String -- ^ stdin       -> IO (String,String,ExitCode) popen file args minput =-  E.handle (\(E.SomeException e) -> return ([],show e,error (show e))) $ +  E.handle (\(E.SomeException e) -> return ([],show e,error (show e))) $    E.bracketOnError (runInteractiveProcess file args Nothing Nothing) (\(_,_,_,pid) -> terminateProcess pid) $      \(inp,out,err,pid) -> do      case minput of         Just input -> hPutStr inp input >> E.catch (hClose inp)-                                                   (\(E.SomeException e) -> return ())+                                                   (\(E.SomeException _) -> return ())         Nothing    -> return ()      -- Now, grab the input@@ -68,5 +67,5 @@     -- And now we wait. We must wait after we read, unsurprisingly.     -- blocks without -threaded, you're warned.     -- and maybe the process has already completed..-    e <- waitForProcess pid +    e <- waitForProcess pid     return (output,errput,e)
Lambdabot/Signals.hs view
@@ -15,8 +15,10 @@ import Control.Monad.Error  type Signal = String-newtype SignalException = SignalException Signal deriving Typeable+newtype SignalException = SignalException Signal deriving (Show,Typeable) +instance Exception SignalException+ ircSignalMessage :: Signal -> [Char] ircSignalMessage s = s @@ -29,8 +31,8 @@  import Data.Typeable -import Control.Concurrent (myThreadId, newEmptyMVar, putMVar, MVar, ThreadId)-import Control.OldException (throwDynTo)+import Control.Concurrent    (myThreadId, newEmptyMVar, putMVar, MVar, ThreadId)+import Control.Exception.Base (Exception,throwTo) import Control.Monad.Error  import System.IO.Unsafe@@ -38,8 +40,10 @@  -- A new type for the SignalException, must be Typeable so we can make a -- dynamic exception out of it.-newtype SignalException = SignalException Signal deriving Typeable+newtype SignalException = SignalException Signal deriving (Show, Typeable) +instance Exception SignalException+ -- -- A bit of sugar for installing a new handler --@@ -99,7 +103,7 @@   = CatchOnce $ do         putMVar catchLock ()         releaseSignals-        throwDynTo threadid $ SignalException s+        throwTo threadid $ SignalException s  -- -- | Release all signal handlers@@ -125,8 +129,8 @@ -- withIrcSignalCatch :: (MonadError e m,MonadIO m) => m () -> m () withIrcSignalCatch m = do-    io $ installHandler sigPIPE Ignore Nothing-    io $ installHandler sigALRM Ignore Nothing+    _ <- io $ installHandler sigPIPE Ignore Nothing+    _ <- io $ installHandler sigALRM Ignore Nothing     threadid <- io myThreadId     withHandlerList ircSignalsToCatch (ircSignalHandler threadid) m #endif
Lambdabot/Util.hs view
@@ -57,8 +57,6 @@  -- getStdRandom has a bug, see safeGetStdRandom below. import System.Random hiding (split,random,getStdRandom)--import System.IO import qualified System.Time as T  ------------------------------------------------------------------------@@ -375,7 +373,7 @@   -- killThread blocks until the thread has been killed.  Therefore, we call   -- killThread asynchronously in case one thread is blocked in a foreign   -- call.-  forkIO $ killThread c1 >> killThread c2+  _ <- forkIO $ killThread c1 >> killThread c2   return r  -- | run an action with a timeout
lambdabot-utils.cabal view
@@ -1,12 +1,12 @@-Name:                lambdabot-utils-Version:             4.2.1-License:             GPL-License-file:        LICENSE-Author:              Don Stewart-Maintainer:          Cale Gibbard <cgibbard@gmail.com>-Category:            Development, Web-Synopsis:            Utility libraries for the advanced IRC bot, Lambdabot-Description:         Lambdabot is an IRC bot written over several years by+name:                lambdabot-utils+version:             4.2.2+license:             GPL+license-file:        LICENSE+author:              Don Stewart et al.+maintainer:          Jan Stolarek <jan.stolarek@p.lodz.pl>+category:            Development, Web+synopsis:            Utility libraries for the advanced IRC bot, Lambdabot+description:         Lambdabot is an IRC bot written over several years by                      those on the #haskell IRC channel.                      .                      Our own custom libraries for various plugin functions.@@ -22,13 +22,47 @@                      Serial.hs:: a serialisation API                      .                      Util.hs: miscellaneous string, and other, functions-Homepage:            http://haskell.org/haskellwiki/Lambdabot+homepage:            http://haskell.org/haskellwiki/Lambdabot+bug-reports:         https://github.com/killy9999/lambdabot-utils/issues build-type:          Simple+tested-with:         GHC>=7.6+cabal-version:       >= 1.10 -Build-depends:   base >= 4 && < 5, haskell-src, containers, zlib, bytestring, mtl, syb,-                 regex-compat, regex-posix, process, network, old-time, binary, unix, random, tagsoup>0.6, utf8-string-Exposed-modules: Lambdabot.FixPrecedence, Lambdabot.Serial,-                 Lambdabot.Error, Lambdabot.Url, Lambdabot.Process,-                 Lambdabot.Regex, Lambdabot.MiniHTTP, Lambdabot.AltTime,-                 Lambdabot.Pointful, Lambdabot.Parser, Lambdabot.Signals,-                 Lambdabot.Util+source-repository head+   type:     git+   location: git://github.com/killy9999/lambdabot-utils++library+  default-language: Haskell2010+  build-depends:    base >=4 && <5,+                    binary,+                    bytestring,+                    containers,+                    haskell-src,+                    mtl,+                    network,+                    old-time,+                    process,+                    random,+                    regex-compat,+                    regex-posix,+                    syb,+                    tagsoup > 0.6,+                    unix,+                    utf8-string,+                    zlib++  ghc-options:      -Wall++  exposed-modules:  Lambdabot.AltTime,+                    Lambdabot.Error,+                    Lambdabot.FixPrecedence,+                    Lambdabot.MiniHTTP,+                    Lambdabot.Parser,+                    Lambdabot.Pointful,+                    Lambdabot.Process,+                    Lambdabot.Regex,+                    Lambdabot.Serial,+                    Lambdabot.Signals,+                    Lambdabot.Url,+                    Lambdabot.Util