lambdabot 4.3 → 4.3.0.1
raw patch · 60 files changed
+321/−287 lines, 60 filesdep ~haskell-src-extsPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: haskell-src-exts
API changes (from Hackage documentation)
- Lambdabot.Plugin.Activity: theModule :: Module [(UTCTime, Nick)]
- Lambdabot.Plugin.BF: theModule :: Module ()
- Lambdabot.Plugin.Base: theModule :: Module (GlobalPrivate () ())
- Lambdabot.Plugin.Check: theModule :: Module ()
- Lambdabot.Plugin.Compose: theModule :: Module ()
- Lambdabot.Plugin.Dice: theModule :: Module ()
- Lambdabot.Plugin.Dict: theModule :: Module ()
- Lambdabot.Plugin.Djinn: theModule :: Module (Maybe DjinnEnv)
- Lambdabot.Plugin.Dummy: theModule :: Module ()
- Lambdabot.Plugin.Elite: theModule :: Module ()
- Lambdabot.Plugin.Error: theModule :: Module ()
- Lambdabot.Plugin.Eval: eval :: MonadLB m => String -> m String
- Lambdabot.Plugin.Eval: theModule :: Module ()
- Lambdabot.Plugin.Filter: theModule :: Module [(String, FilePath, String)]
- Lambdabot.Plugin.Free: theModule :: Module ()
- Lambdabot.Plugin.Fresh: theModule :: Module Integer
- Lambdabot.Plugin.Haddock: theModule :: Module HaddockState
- Lambdabot.Plugin.Hello: theModule :: Module ()
- Lambdabot.Plugin.Help: theModule :: Module ()
- Lambdabot.Plugin.Hoogle: theModule :: Module [String]
- Lambdabot.Plugin.IRC: theModule :: Module ()
- Lambdabot.Plugin.Instances: theModule :: Module ()
- Lambdabot.Plugin.Karma: theModule :: Module KarmaState
- Lambdabot.Plugin.Localtime: theModule :: Module TimeMap
- Lambdabot.Plugin.Log: theModule :: Module (Map Channel ChanState)
- Lambdabot.Plugin.More: theModule :: Module (GlobalPrivate () [String])
- Lambdabot.Plugin.Numberwang: State :: !Int -> !Int -> NumberwangState
- Lambdabot.Plugin.Numberwang: checkNumberwang :: (MonadLBState m, LBState m ~ NumberwangState) => Bool -> Int -> m Bool
- Lambdabot.Plugin.Numberwang: cmdDist :: RVar Int
- Lambdabot.Plugin.Numberwang: conDist :: RVar Int
- Lambdabot.Plugin.Numberwang: data NumberwangState
- Lambdabot.Plugin.Numberwang: doNumberwang :: (Num a, Ord a, MonadLBState m, LBState m ~ NumberwangState) => Bool -> a -> Cmd m ()
- Lambdabot.Plugin.Numberwang: nextCmd :: NumberwangState -> !Int
- Lambdabot.Plugin.Numberwang: nextCon :: NumberwangState -> !Int
- Lambdabot.Plugin.Numberwang: numbers :: RealFrac t => String -> [t]
- Lambdabot.Plugin.Numberwang: theModule :: Module NumberwangState
- Lambdabot.Plugin.Numberwang: withState :: (MonadLBState m, LBState m ~ NumberwangState) => Bool -> (Int -> (Int -> m ()) -> RVar Int -> m a) -> m a
- Lambdabot.Plugin.OEIS: theModule :: Module ()
- Lambdabot.Plugin.OfflineRC: theModule :: Module OfflineRCState
- Lambdabot.Plugin.Pl: theModule :: Module (GlobalPrivate () (Int, TopLevel))
- Lambdabot.Plugin.Pointful: theModule :: Module ()
- Lambdabot.Plugin.Poll: theModule :: Module (Map PollName Poll)
- Lambdabot.Plugin.Pretty: theModule :: Module ()
- Lambdabot.Plugin.Quote: theModule :: Module (Map ByteString [ByteString])
- Lambdabot.Plugin.Search: theModule :: Module ()
- Lambdabot.Plugin.Seen: theModule :: Module (Map Channel Int, Map PackedNick UserStatus)
- Lambdabot.Plugin.Slap: theModule :: Module ()
- Lambdabot.Plugin.Source: theModule :: Module (Map ByteString ByteString)
- Lambdabot.Plugin.Spell: theModule :: Module Bool
- Lambdabot.Plugin.Stats: theModule :: Module StatsD
- Lambdabot.Plugin.System: theModule :: Module SystemState
- Lambdabot.Plugin.Tell: theModule :: Module NoticeBoard
- Lambdabot.Plugin.Ticker: theModule :: Module ()
- Lambdabot.Plugin.Todo: theModule :: Module TodoState
- Lambdabot.Plugin.Topic: theModule :: Module ()
- Lambdabot.Plugin.Type: theModule :: Module ()
- Lambdabot.Plugin.UnMtl: theModule :: Module ()
- Lambdabot.Plugin.Undo: theModule :: Module ()
- Lambdabot.Plugin.Unlambda: theModule :: Module ()
- Lambdabot.Plugin.Url: theModule :: Module Bool
- Lambdabot.Plugin.Version: theModule :: Module ()
- Lambdabot.Plugin.Vixen: theModule :: Module (Bool, String -> IO [Char])
- Lambdabot.Plugin.Where: theModule :: Module (Map ByteString ByteString)
+ Lambdabot.Plugin.Activity: activityPlugin :: Module [(UTCTime, Nick)]
+ Lambdabot.Plugin.BF: bfPlugin :: Module ()
+ Lambdabot.Plugin.Base: base :: Module (GlobalPrivate () ())
+ Lambdabot.Plugin.Check: checkPlugin :: Module ()
+ Lambdabot.Plugin.Compose: composePlugin :: Module ()
+ Lambdabot.Plugin.Dice: dicePlugin :: Module ()
+ Lambdabot.Plugin.Dict: dictPlugin :: Module ()
+ Lambdabot.Plugin.Djinn: djinnPlugin :: Module (Maybe DjinnEnv)
+ Lambdabot.Plugin.Dummy: dummyPlugin :: Module ()
+ Lambdabot.Plugin.Elite: elitePlugin :: Module ()
+ Lambdabot.Plugin.Error: errorPlugin :: Module ()
+ Lambdabot.Plugin.Eval: evalPlugin :: Module ()
+ Lambdabot.Plugin.Eval: runGHC :: MonadLB m => String -> m String
+ Lambdabot.Plugin.Filter: filterPlugin :: Module [(String, FilePath, String)]
+ Lambdabot.Plugin.Free: freePlugin :: Module ()
+ Lambdabot.Plugin.Fresh: freshPlugin :: Module Integer
+ Lambdabot.Plugin.Haddock: haddockPlugin :: Module HaddockState
+ Lambdabot.Plugin.Hello: helloPlugin :: Module ()
+ Lambdabot.Plugin.Help: helpPlugin :: Module ()
+ Lambdabot.Plugin.Hoogle: hooglePlugin :: Module [String]
+ Lambdabot.Plugin.IRC: ircPlugin :: Module ()
+ Lambdabot.Plugin.Instances: instancesPlugin :: Module ()
+ Lambdabot.Plugin.Karma: karmaPlugin :: Module KarmaState
+ Lambdabot.Plugin.Localtime: localtimePlugin :: Module TimeMap
+ Lambdabot.Plugin.Log: logPlugin :: Module (Map Channel ChanState)
+ Lambdabot.Plugin.More: morePlugin :: Module (GlobalPrivate () [String])
+ Lambdabot.Plugin.Numberwang: numberwangPlugin :: Module NumberwangState
+ Lambdabot.Plugin.OEIS: oeisPlugin :: Module ()
+ Lambdabot.Plugin.OfflineRC: offlineRC :: Module OfflineRCState
+ Lambdabot.Plugin.Pl: plPlugin :: Module (GlobalPrivate () (Int, TopLevel))
+ Lambdabot.Plugin.Pointful: pointfulPlugin :: Module ()
+ Lambdabot.Plugin.Poll: pollPlugin :: Module (Map PollName Poll)
+ Lambdabot.Plugin.Pretty: prettyPlugin :: Module ()
+ Lambdabot.Plugin.Quote: quotePlugin :: Module (Map ByteString [ByteString])
+ Lambdabot.Plugin.Search: searchPlugin :: Module ()
+ Lambdabot.Plugin.Seen: seenPlugin :: Module (Map Channel Int, Map PackedNick UserStatus)
+ Lambdabot.Plugin.Slap: slapPlugin :: Module ()
+ Lambdabot.Plugin.Source: sourcePlugin :: Module (Map ByteString ByteString)
+ Lambdabot.Plugin.Spell: spellPlugin :: Module Bool
+ Lambdabot.Plugin.Stats: statsPlugin :: Module StatsD
+ Lambdabot.Plugin.System: system :: Module SystemState
+ Lambdabot.Plugin.Tell: tellPlugin :: Module NoticeBoard
+ Lambdabot.Plugin.Ticker: tickerPlugin :: Module ()
+ Lambdabot.Plugin.Todo: todoPlugin :: Module TodoState
+ Lambdabot.Plugin.Topic: topicPlugin :: Module ()
+ Lambdabot.Plugin.Type: typePlugin :: Module ()
+ Lambdabot.Plugin.UnMtl: unmtlPlugin :: Module ()
+ Lambdabot.Plugin.Undo: undoPlugin :: Module ()
+ Lambdabot.Plugin.Unlambda: unlambdaPlugin :: Module ()
+ Lambdabot.Plugin.Url: urlPlugin :: Module Bool
+ Lambdabot.Plugin.Version: versionPlugin :: Module ()
+ Lambdabot.Plugin.Vixen: vixenPlugin :: Module (Bool, String -> IO [Char])
+ Lambdabot.Plugin.Where: wherePlugin :: Module (Map ByteString ByteString)
Files
- README.md +1/−0
- lambdabot.cabal +2/−2
- main/Main.hs +10/−1
- main/Modules.hs +94/−94
- src/Lambdabot.hs +1/−2
- src/Lambdabot/Main.hs +2/−4
- src/Lambdabot/Monad.hs +1/−2
- src/Lambdabot/Plugin.hs +0/−1
- src/Lambdabot/Plugin/Activity.hs +5/−4
- src/Lambdabot/Plugin/BF.hs +3/−3
- src/Lambdabot/Plugin/Base.hs +4/−3
- src/Lambdabot/Plugin/Check.hs +5/−5
- src/Lambdabot/Plugin/Compose.hs +3/−3
- src/Lambdabot/Plugin/Dice.hs +4/−3
- src/Lambdabot/Plugin/Dict.hs +4/−3
- src/Lambdabot/Plugin/Djinn.hs +4/−3
- src/Lambdabot/Plugin/Dummy.hs +4/−3
- src/Lambdabot/Plugin/Elite.hs +4/−3
- src/Lambdabot/Plugin/Error.hs +3/−3
- src/Lambdabot/Plugin/Eval.hs +8/−7
- src/Lambdabot/Plugin/Filter.hs +4/−3
- src/Lambdabot/Plugin/Free.hs +3/−3
- src/Lambdabot/Plugin/Fresh.hs +3/−3
- src/Lambdabot/Plugin/Haddock.hs +3/−3
- src/Lambdabot/Plugin/Hello.hs +3/−3
- src/Lambdabot/Plugin/Help.hs +4/−3
- src/Lambdabot/Plugin/Hoogle.hs +4/−3
- src/Lambdabot/Plugin/IRC.hs +12/−10
- src/Lambdabot/Plugin/Instances.hs +4/−3
- src/Lambdabot/Plugin/Karma.hs +3/−3
- src/Lambdabot/Plugin/Localtime.hs +3/−3
- src/Lambdabot/Plugin/Log.hs +4/−3
- src/Lambdabot/Plugin/More.hs +3/−3
- src/Lambdabot/Plugin/Numberwang.hs +3/−3
- src/Lambdabot/Plugin/OEIS.hs +3/−3
- src/Lambdabot/Plugin/OfflineRC.hs +4/−3
- src/Lambdabot/Plugin/Pl.hs +4/−3
- src/Lambdabot/Plugin/Pointful.hs +3/−3
- src/Lambdabot/Plugin/Poll.hs +3/−3
- src/Lambdabot/Plugin/Pretty.hs +3/−3
- src/Lambdabot/Plugin/Quote.hs +4/−3
- src/Lambdabot/Plugin/Search.hs +4/−3
- src/Lambdabot/Plugin/Seen.hs +9/−8
- src/Lambdabot/Plugin/Slap.hs +4/−3
- src/Lambdabot/Plugin/Source.hs +4/−3
- src/Lambdabot/Plugin/Spell.hs +4/−3
- src/Lambdabot/Plugin/Stats.hs +4/−3
- src/Lambdabot/Plugin/System.hs +5/−4
- src/Lambdabot/Plugin/Tell.hs +5/−4
- src/Lambdabot/Plugin/Ticker.hs +3/−3
- src/Lambdabot/Plugin/Todo.hs +3/−3
- src/Lambdabot/Plugin/Topic.hs +6/−5
- src/Lambdabot/Plugin/Type.hs +4/−4
- src/Lambdabot/Plugin/UnMtl.hs +3/−3
- src/Lambdabot/Plugin/Undo.hs +4/−4
- src/Lambdabot/Plugin/Unlambda.hs +3/−3
- src/Lambdabot/Plugin/Url.hs +3/−3
- src/Lambdabot/Plugin/Version.hs +3/−3
- src/Lambdabot/Plugin/Vixen.hs +4/−3
- src/Lambdabot/Plugin/Where.hs +4/−3
README.md view
@@ -15,6 +15,7 @@ - `djinn` for the "djinn" plugin, which tries to find Haskell functions matching arbitrary types. Available on Hackage. - `ghc` and `mueval` for the "eval" plugin, which evaluates Haskell expressions in chat (when prefixed with "> "; e.g. `> 1 + 1`). GHC is available from haskell.org (the Haskell Platform is recommended). Mueval is available on Hackage. - `hoogle` for the "hoogle" plugin, which provides a command for searching Haskell APIs. Available from Hackage.+- GNU talk-filters (optional) for the "filters" plugin. Available via most package managers, I believe. - `unlambda` for executing unlambda programs. Available on Hackage. Some of these dependencies (those with corresponding hackage libraries) will be installed by cabal, but not all of them will. In all cases, cabal does not actually track the executables so if they have previously been installed and deleted on your system (without unregistering the matching library), you will have to manually reinstall them.
lambdabot.cabal view
@@ -1,5 +1,5 @@ name: lambdabot-version: 4.3+version: 4.3.0.1 license: GPL license-file: LICENSE@@ -166,7 +166,7 @@ edit-distance >= 0.2, filepath >= 1.3, haskeline >= 0.7,- haskell-src-exts >= 1.12.0,+ haskell-src-exts >= 1.14.0, hstatsd >= 0.1, hslogger >= 1.2.1, HTTP >= 4000,
main/Main.hs view
@@ -21,6 +21,7 @@ , Option "e" [] (arg "<command>" onStartupCmds strs) "Run a lambdabot command instead of a REPL" , Option "l" [] (arg "<level>" consoleLogLevel level) "Set the logging level" , Option "t" ["trust"] (arg "<package>" trustedPackages strs) "Trust the specified packages when evaluating code"+ , Option "V" ["version"] (NoArg version) "Print the version of lambdabot" ] where arg :: String -> Config t -> (String -> IO t) -> ArgDescr (IO (DSum Config)) arg descr key fn = ReqArg (fmap (key :=>) . fn) descr@@ -36,6 +37,14 @@ +versionString :: String+versionString = ("lambdabot version " ++ showVersion lambdabotVersion)++version :: IO a+version = do+ putStrLn versionString+ exitWith ExitSuccess+ usage :: [String] -> IO a usage errors = do cmd <- getProgName@@ -46,7 +55,7 @@ mapM_ (hPutStrLn out) errors when isErr (hPutStrLn out "") - hPutStrLn out ("lambdabot " ++ showVersion lambdabotVersion)+ hPutStrLn out versionString hPutStr out (usageInfo (cmd ++ " [options]") flags) exitWith (if isErr then ExitFailure 1 else ExitSuccess)
main/Modules.hs view
@@ -7,105 +7,105 @@ -- to add a new plugin, one must first add a qualified import here, and also -- add a string in the list below-import qualified Lambdabot.Plugin.Activity-import qualified Lambdabot.Plugin.Base-import qualified Lambdabot.Plugin.BF-import qualified Lambdabot.Plugin.Check-import qualified Lambdabot.Plugin.Compose-import qualified Lambdabot.Plugin.Dice-import qualified Lambdabot.Plugin.Dict-import qualified Lambdabot.Plugin.Djinn-import qualified Lambdabot.Plugin.Dummy-import qualified Lambdabot.Plugin.Elite-import qualified Lambdabot.Plugin.Eval-import qualified Lambdabot.Plugin.Filter-import qualified Lambdabot.Plugin.Free-import qualified Lambdabot.Plugin.Fresh-import qualified Lambdabot.Plugin.Haddock-import qualified Lambdabot.Plugin.Help-import qualified Lambdabot.Plugin.Hoogle-import qualified Lambdabot.Plugin.Instances-import qualified Lambdabot.Plugin.IRC-import qualified Lambdabot.Plugin.Karma-import qualified Lambdabot.Plugin.Localtime-import qualified Lambdabot.Plugin.More-import qualified Lambdabot.Plugin.OEIS-import qualified Lambdabot.Plugin.OfflineRC-import qualified Lambdabot.Plugin.Pl-import qualified Lambdabot.Plugin.Pointful-import qualified Lambdabot.Plugin.Poll-import qualified Lambdabot.Plugin.Pretty-import qualified Lambdabot.Plugin.Quote-import qualified Lambdabot.Plugin.Search-import qualified Lambdabot.Plugin.Seen-import qualified Lambdabot.Plugin.Slap-import qualified Lambdabot.Plugin.Source-import qualified Lambdabot.Plugin.Spell-import qualified Lambdabot.Plugin.System-import qualified Lambdabot.Plugin.Tell-import qualified Lambdabot.Plugin.Ticker-import qualified Lambdabot.Plugin.Todo-import qualified Lambdabot.Plugin.Topic-import qualified Lambdabot.Plugin.Type-import qualified Lambdabot.Plugin.Undo-import qualified Lambdabot.Plugin.Unlambda-import qualified Lambdabot.Plugin.UnMtl-import qualified Lambdabot.Plugin.Url-import qualified Lambdabot.Plugin.Version-import qualified Lambdabot.Plugin.Vixen-import qualified Lambdabot.Plugin.Where+import Lambdabot.Plugin.Activity+import Lambdabot.Plugin.Base+import Lambdabot.Plugin.BF+import Lambdabot.Plugin.Check+import Lambdabot.Plugin.Compose+import Lambdabot.Plugin.Dice+import Lambdabot.Plugin.Dict+import Lambdabot.Plugin.Djinn+import Lambdabot.Plugin.Dummy+import Lambdabot.Plugin.Elite+import Lambdabot.Plugin.Eval+import Lambdabot.Plugin.Filter+import Lambdabot.Plugin.Free+import Lambdabot.Plugin.Fresh+import Lambdabot.Plugin.Haddock+import Lambdabot.Plugin.Help+import Lambdabot.Plugin.Hoogle+import Lambdabot.Plugin.Instances+import Lambdabot.Plugin.IRC+import Lambdabot.Plugin.Karma+import Lambdabot.Plugin.Localtime+import Lambdabot.Plugin.More+import Lambdabot.Plugin.OEIS+import Lambdabot.Plugin.OfflineRC+import Lambdabot.Plugin.Pl+import Lambdabot.Plugin.Pointful+import Lambdabot.Plugin.Poll+import Lambdabot.Plugin.Pretty+import Lambdabot.Plugin.Quote+import Lambdabot.Plugin.Search+import Lambdabot.Plugin.Seen+import Lambdabot.Plugin.Slap+import Lambdabot.Plugin.Source+import Lambdabot.Plugin.Spell+import Lambdabot.Plugin.System+import Lambdabot.Plugin.Tell+import Lambdabot.Plugin.Ticker+import Lambdabot.Plugin.Todo+import Lambdabot.Plugin.Topic+import Lambdabot.Plugin.Type+import Lambdabot.Plugin.Undo+import Lambdabot.Plugin.Unlambda+import Lambdabot.Plugin.UnMtl+import Lambdabot.Plugin.Url+import Lambdabot.Plugin.Version+import Lambdabot.Plugin.Vixen+import Lambdabot.Plugin.Where modulesInfo :: Modules modulesInfo = $(modules $ nub -- these must be listed first. Maybe. Nobody really -- knows, but better to be safe than sorry.- [ "Base"- , "System"- , "OfflineRC"+ [ "base"+ , "system"+ , "offlineRC" -- plugins also go in this list:- , "Activity"- , "BF"- , "Check"- , "Compose"- , "Dice"- , "Dict"- , "Djinn"- , "Dummy"- , "Elite"- , "Eval"- , "Filter"- , "Free"- , "Fresh"- , "Haddock"- , "Help"- , "Hoogle"- , "Instances"- , "IRC"- , "Karma"- , "Localtime"- , "More"- , "OEIS"- , "Pl"- , "Pointful"- , "Poll"- , "Pretty"- , "Quote"- , "Search"- , "Seen"- , "Slap"- , "Source"- , "Spell"- , "Tell"- , "Ticker"- , "Todo"- , "Topic"- , "Type"- , "Undo"- , "Unlambda"- , "UnMtl"- , "Url"- , "Version"- , "Vixen"- , "Where"+ , "activityPlugin"+ , "bfPlugin"+ , "checkPlugin"+ , "composePlugin"+ , "dicePlugin"+ , "dictPlugin"+ , "djinnPlugin"+ , "dummyPlugin"+ , "elitePlugin"+ , "evalPlugin"+ , "filterPlugin"+ , "freePlugin"+ , "freshPlugin"+ , "haddockPlugin"+ , "helpPlugin"+ , "hooglePlugin"+ , "instancesPlugin"+ , "ircPlugin"+ , "karmaPlugin"+ , "localtimePlugin"+ , "morePlugin"+ , "oeisPlugin"+ , "plPlugin"+ , "pointfulPlugin"+ , "pollPlugin"+ , "prettyPlugin"+ , "quotePlugin"+ , "searchPlugin"+ , "seenPlugin"+ , "slapPlugin"+ , "sourcePlugin"+ , "spellPlugin"+ , "tellPlugin"+ , "tickerPlugin"+ , "todoPlugin"+ , "topicPlugin"+ , "typePlugin"+ , "undoPlugin"+ , "unlambdaPlugin"+ , "unmtlPlugin"+ , "urlPlugin"+ , "versionPlugin"+ , "vixenPlugin"+ , "wherePlugin" ])
src/Lambdabot.hs view
@@ -41,7 +41,6 @@ import qualified Data.Map as M import Data.Random.Source import qualified Data.Set as S-import System.IO ------------------------------------------------------------------------ --@@ -150,7 +149,7 @@ modify $ \state' -> state' { ircStayConnected = False } send $ quit svr msg liftIO $ threadDelay 1000- io $ hPutStrLn stderr "Quit"+ noticeM "Quitting" ircReconnect :: String -> String -> LB () ircReconnect svr msg = do
src/Lambdabot/Main.hs view
@@ -24,7 +24,6 @@ import Lambdabot.Util.Signals import Control.Exception.Lifted as E-import Data.Char import Data.Dependent.Sum import Data.Typeable import Data.Version@@ -104,6 +103,5 @@ modules xs = [| sequence_ $(listE $ map instalify xs) |] where instalify x =- let module' = varE $ mkName $ concat $ ["Lambdabot.Plugin.", x, ".theModule"]- low = stringE $ map toLower x- in [| ircLoadModule $module' $low |]+ let module' = varE $ mkName x+ in [| ircLoadModule $module' x |]
src/Lambdabot/Monad.hs view
@@ -58,7 +58,6 @@ import qualified Data.Map as M import qualified Data.Set as S import System.Console.Haskeline.MonadException (MonadException)-import System.IO ------------------------------------------------------------------------ --@@ -178,7 +177,7 @@ s <- gets ircServerMap case M.lookup (Msg.server msg) s of Just (_, sendf) -> sendf msg- Nothing -> io $ hPutStrLn stderr $ "sending message to bogus server: " ++ show msg+ Nothing -> warningM $ "sending message to bogus server: " ++ show msg received :: IrcMessage -> LB () received msg = do
src/Lambdabot/Plugin.hs view
@@ -32,7 +32,6 @@ , module Lambdabot.Command , module Lambdabot.State , module Lambdabot.File- , module Lambdabot.Util , module Lambdabot.Util.Serial ) where
src/Lambdabot/Plugin/Activity.hs view
@@ -1,8 +1,9 @@ -- | Logging an IRC channel..-module Lambdabot.Plugin.Activity (theModule) where+module Lambdabot.Plugin.Activity (activityPlugin) where -import Lambdabot.Plugin import Lambdabot+import Lambdabot.Plugin+import Lambdabot.Util import Control.Arrow ((&&&)) import Control.Exception (evaluate)@@ -13,8 +14,8 @@ type ActivityState = [(UTCTime,Nick)] type Activity = ModuleT ActivityState LB -theModule :: Module [(UTCTime, Nick)]-theModule = newModule+activityPlugin :: Module [(UTCTime, Nick)]+activityPlugin = newModule { moduleDefState = return [] , moduleInit = bindModule2 activityFilter >>= ircInstallOutputFilter
src/Lambdabot/Plugin/BF.hs view
@@ -3,7 +3,7 @@ -- | A plugin for the Haskell interpreter for the brainf*ck language -- http://www.muppetlabs.com/~breadbox/bf/-module Lambdabot.Plugin.BF (theModule) where+module Lambdabot.Plugin.BF (bfPlugin) where import Lambdabot.Plugin import Lambdabot.Util.Process@@ -11,8 +11,8 @@ import Data.Char import Text.Regex.TDFA -theModule :: Module ()-theModule = newModule+bfPlugin :: Module ()+bfPlugin = newModule { moduleCmds = return [ (command "bf") { help = say "bf <expr>. Evaluate a brainf*ck expression"
src/Lambdabot/Plugin/Base.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE PatternGuards #-} -- | Lambdabot base module. Controls message send and receive-module Lambdabot.Plugin.Base (theModule) where+module Lambdabot.Plugin.Base (base) where import Lambdabot import Lambdabot.Command@@ -11,6 +11,7 @@ import Lambdabot.Monad import Lambdabot.Nick import Lambdabot.Plugin+import Lambdabot.Util import Control.Applicative import Control.Exception.Lifted as E@@ -25,8 +26,8 @@ type BaseState = GlobalPrivate () () type Base = ModuleT BaseState LB -theModule :: Module (GlobalPrivate () ())-theModule = newModule+base :: Module (GlobalPrivate () ())+base = newModule { moduleDefState = return $ mkGlobalPrivate 20 () , moduleInit = do ircSignalConnect "PING" doPING
src/Lambdabot/Plugin/Check.hs view
@@ -2,14 +2,14 @@ -- GPL version 2 or later (see http://www.gnu.org/copyleft/gpl.html) -- | Test a property with QuickCheck-module Lambdabot.Plugin.Check (theModule) where+module Lambdabot.Plugin.Check (checkPlugin) where import Lambdabot.Plugin-import Lambdabot.Plugin.Eval (eval)+import Lambdabot.Plugin.Eval (runGHC) import qualified Language.Haskell.Exts as Hs -theModule :: Module ()-theModule = newModule+checkPlugin :: Module ()+checkPlugin = newModule { moduleCmds = return [ (command "check") { help = do@@ -24,4 +24,4 @@ check src = case Hs.parseExp src of Hs.ParseFailed l e -> return (Hs.prettyPrint l ++ ':' : e)- Hs.ParseOk{} -> eval ("myquickcheck (" ++ src ++ ") `seq` hsep[]")+ Hs.ParseOk{} -> runGHC ("myquickcheck (" ++ src ++ ") `seq` hsep[]")
src/Lambdabot/Plugin/Compose.hs view
@@ -4,7 +4,7 @@ -- Another progressive plugin. Compose two (for now) plugins transparently -- A sort of mini interpreter. Could do with some more thinking.-module Lambdabot.Plugin.Compose (theModule) where+module Lambdabot.Plugin.Compose (composePlugin) where import Lambdabot.Command import Lambdabot.Monad@@ -19,8 +19,8 @@ type Compose = ModuleT () LB -theModule :: Module ()-theModule = newModule+composePlugin :: Module ()+composePlugin = newModule { moduleCmds = return [ (command "@") { aliases = ["?"]
src/Lambdabot/Plugin/Dice.hs view
@@ -2,17 +2,18 @@ -- Original version copyright Einar Karttunen <ekarttun@cs.helsinki.fi> 2005-04-06. -- Massive rewrite circa 2008-10-20 copyright James Cook <mokus@deepbondi.net>-module Lambdabot.Plugin.Dice (theModule) where+module Lambdabot.Plugin.Dice (dicePlugin) where import Lambdabot.Plugin+import Lambdabot.Util import Data.List import Data.Random.Dice (rollEm) type Dice = ModuleT () LB -theModule :: Module ()-theModule = newModule+dicePlugin :: Module ()+dicePlugin = newModule { moduleCmds = return [ (command "dice") { aliases = ["roll"]
src/Lambdabot/Plugin/Dict.hs view
@@ -1,18 +1,19 @@ {-# LANGUAGE PatternGuards #-} -- | DICT (RFC 2229) Lookup Module for lambdabot IRC robot. -- Tom Moertel <tom@moertel.com>-module Lambdabot.Plugin.Dict (theModule) where+module Lambdabot.Plugin.Dict (dictPlugin) where import Lambdabot.Plugin import qualified Lambdabot.Plugin.Dict.DictLookup as Dict+import Lambdabot.Util import Control.Monad import Data.List type Dict = ModuleT () LB -theModule :: Module ()-theModule = newModule+dictPlugin :: Module ()+dictPlugin = newModule { moduleCmds = return $ [ (command "dict-help") { help = getHelp []
src/Lambdabot/Plugin/Djinn.hs view
@@ -5,11 +5,12 @@ -- Written: Mon Dec 12 10:16:56 EST 2005 -- | A binding to Djinn.-module Lambdabot.Plugin.Djinn (theModule) where+module Lambdabot.Plugin.Djinn (djinnPlugin) where import Lambdabot.Config.Core import Lambdabot.Logging import Lambdabot.Plugin+import Lambdabot.Util import Control.Exception.Lifted as E import Control.Monad@@ -25,8 +26,8 @@ type Djinn = ModuleT (Maybe DjinnEnv) LB type Decl = String -theModule :: Module (Maybe DjinnEnv)-theModule = newModule+djinnPlugin :: Module (Maybe DjinnEnv)+djinnPlugin = newModule { moduleSerialize = Nothing , moduleDefState = return Nothing
src/Lambdabot/Plugin/Dummy.hs view
@@ -1,17 +1,18 @@ -- | Simple template module -- Contains many constant bot commands.-module Lambdabot.Plugin.Dummy (theModule) where+module Lambdabot.Plugin.Dummy (dummyPlugin) where import Lambdabot.Plugin import Lambdabot.Plugin.Dummy.DocAssocs (docAssocs)+import Lambdabot.Util import Data.Char import qualified Data.ByteString.Char8 as P import qualified Data.Map as M import System.FilePath -theModule :: Module ()-theModule = newModule+dummyPlugin :: Module ()+dummyPlugin = newModule { moduleCmds = return $ (command "eval") { help = say "eval. Do nothing (perversely)"
src/Lambdabot/Plugin/Elite.hs view
@@ -3,9 +3,10 @@ -- Inspired by the following page: -- http://www.microsoft.com/athome/security/children/kidtalk.mspx-module Lambdabot.Plugin.Elite (theModule) where+module Lambdabot.Plugin.Elite (elitePlugin) where import Lambdabot.Plugin+import Lambdabot.Util import Control.Arrow import Control.Monad@@ -13,8 +14,8 @@ import Data.Maybe import Text.Regex.TDFA -theModule :: Module ()-theModule = newModule+elitePlugin :: Module ()+elitePlugin = newModule { moduleCmds = return [ (command "elite") { aliases = ["leet", "l33t", "1337"]
src/Lambdabot/Plugin/Error.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -fno-warn-overlapping-patterns #-}-module Lambdabot.Plugin.Error (theModule, failOnLoad, errorOnLoad) where+module Lambdabot.Plugin.Error (errorPlugin, failOnLoad, errorOnLoad) where import Lambdabot.Config import Lambdabot.Plugin@@ -12,8 +12,8 @@ config "failOnLoad" [t| Bool |] [| False |] config "errorOnLoad" [t| Bool |] [| False |] -theModule :: Module ()-theModule = newModule+errorPlugin :: Module ()+errorPlugin = newModule { moduleCmds = return [ (command "error") { help = say "Throw an error, see what lambdabot does with it!"
src/Lambdabot/Plugin/Eval.hs view
@@ -2,9 +2,10 @@ -- GPL version 2 or later (see http://www.gnu.org/copyleft/gpl.html) -- | A Haskell evaluator for the pure part, using mueval-module Lambdabot.Plugin.Eval (theModule, eval, exts) where+module Lambdabot.Plugin.Eval (evalPlugin, runGHC, exts) where import Lambdabot.Plugin+import Lambdabot.Util import Control.Exception (try, SomeException) import Control.Monad@@ -15,12 +16,12 @@ import System.Exit import System.Process -theModule :: Module ()-theModule = newModule+evalPlugin :: Module ()+evalPlugin = newModule { moduleCmds = return [ (command "run") { help = say "run <expr>. You have Haskell, 3 seconds and no IO. Go nuts!"- , process = lim80 . eval+ , process = lim80 . runGHC } , (command "let") { aliases = ["define"] -- because @define always gets "corrected" to @undefine@@ -40,7 +41,7 @@ , contextual = \txt -> do b <- isEval txt- when b (lim80 (eval (dropPrefix txt)))+ when b (lim80 (runGHC (dropPrefix txt))) } -- extensions to enable for the interpreted expression@@ -66,8 +67,8 @@ dropPrefix :: String -> String dropPrefix = dropWhile (' ' ==) . drop 2 -eval :: MonadLB m => String -> m String-eval src = do+runGHC :: MonadLB m => String -> m String+runGHC src = do load <- lb (findOrCreateLBFile "L.hs") binary <- getConfig muevalBinary trusted <- getConfig trustedPackages
src/Lambdabot/Plugin/Filter.hs view
@@ -2,9 +2,10 @@ -- needs: http://www.hyperrealm.com/main.php?s=talkfilters -- Edward Kmett 2006 -module Lambdabot.Plugin.Filter (theModule) where+module Lambdabot.Plugin.Filter (filterPlugin) where import Lambdabot.Plugin+import Lambdabot.Util import Control.Applicative import Data.Maybe@@ -13,8 +14,8 @@ -- State consists of a map from filter name to executable path -theModule :: Module [(String, FilePath, String)]-theModule = newModule+filterPlugin :: Module [(String, FilePath, String)]+filterPlugin = newModule { moduleDefState = catMaybes <$> sequence [ do mbPath <- io (findExecutable name)
src/Lambdabot/Plugin/Free.hs view
@@ -1,13 +1,13 @@ -- | Free theorems plugin -- Andrew Bromage, 2006-module Lambdabot.Plugin.Free (theModule) where+module Lambdabot.Plugin.Free (freePlugin) where import Lambdabot.Plugin import Lambdabot.Plugin.Free.FreeTheorem import Lambdabot.Plugin.Type (query_ghci) -theModule :: Module ()-theModule = newModule+freePlugin :: Module ()+freePlugin = newModule { moduleCmds = return [ (command "free") { help = say "free <ident>. Generate theorems for free"
src/Lambdabot/Plugin/Fresh.hs view
@@ -1,6 +1,6 @@ -- | Haskell project name generation -- semi-joke-module Lambdabot.Plugin.Fresh (theModule) where+module Lambdabot.Plugin.Fresh (freshPlugin) where import Lambdabot.Plugin @@ -9,8 +9,8 @@ type Fresh = ModuleT Integer LB -theModule :: Module Integer-theModule = newModule+freshPlugin :: Module Integer+freshPlugin = newModule { moduleDefState = return 0 , moduleSerialize = Just stdSerial
src/Lambdabot/Plugin/Haddock.hs view
@@ -1,5 +1,5 @@ -- | Hackish Haddock module.-module Lambdabot.Plugin.Haddock (theModule) where+module Lambdabot.Plugin.Haddock (haddockPlugin) where import Lambdabot.Plugin @@ -10,8 +10,8 @@ type HaddockState = M.Map P.ByteString [P.ByteString] type Haddock = ModuleT HaddockState LB -theModule :: Module HaddockState-theModule = newModule+haddockPlugin :: Module HaddockState+haddockPlugin = newModule { moduleCmds = return [ (command "index") { help = say "index <ident>. Returns the Haskell modules in which <ident> is defined"
src/Lambdabot/Plugin/Hello.hs view
@@ -1,12 +1,12 @@ -- -- | Hello world plugin ---module Lambdabot.Plugin.Hello (theModule) where+module Lambdabot.Plugin.Hello (helloPlugin) where import Lambdabot.Plugin -theModule :: Module ()-theModule = newModule+helloPlugin :: Module ()+helloPlugin = newModule { moduleCmds = return [ (command "hello") { aliases = ["goodbye"]
src/Lambdabot/Plugin/Help.hs view
@@ -1,13 +1,14 @@ -- | Provide help for plugins-module Lambdabot.Plugin.Help (theModule) where+module Lambdabot.Plugin.Help (helpPlugin) where import Lambdabot.Command import Lambdabot.Message (Message) import Lambdabot.Monad import Lambdabot.Plugin+import Lambdabot.Util -theModule :: Module ()-theModule = newModule+helpPlugin :: Module ()+helpPlugin = newModule { moduleCmds = return [ (command "help") { help = say "help <command>. Ask for help for <command>. Try 'list' for all commands"
src/Lambdabot/Plugin/Hoogle.hs view
@@ -2,13 +2,14 @@ -- GPL version 2 or later (see http://www.gnu.org/copyleft/gpl.html) -- | Talk to Neil Mitchell's `Hoogle' program-module Lambdabot.Plugin.Hoogle (theModule) where+module Lambdabot.Plugin.Hoogle (hooglePlugin) where import Lambdabot.Plugin+import Lambdabot.Util import System.Process -theModule :: Module [String]-theModule = newModule+hooglePlugin :: Module [String]+hooglePlugin = newModule { moduleDefState = return [] , moduleCmds = return [ (command "hoogle")
src/Lambdabot/Plugin/IRC.hs view
@@ -1,10 +1,12 @@ -- | The plugin-level IRC interface. -module Lambdabot.Plugin.IRC (theModule) where+module Lambdabot.Plugin.IRC (ircPlugin) where -import Lambdabot.Plugin-import Lambdabot.Monad import Lambdabot.IRC+import Lambdabot.Logging+import Lambdabot.Monad+import Lambdabot.Plugin+import Lambdabot.Util import Control.Concurrent.Lifted import qualified Control.Concurrent.SSem as SSem@@ -20,8 +22,8 @@ type IRC = ModuleT () LB -theModule :: Module ()-theModule = newModule+ircPlugin :: Module ()+ircPlugin = newModule { moduleCmds = return [ (command "irc-connect") { privileged = True@@ -121,13 +123,13 @@ putMVar sendmv () SSem.signal sem1 E.catch - (addServer tag (io . sendMsg tag sock sendmv))+ (addServer tag (io . sendMsg sock sendmv)) (\err@SomeException{} -> io (hClose sock) >> E.throwIO err) lb $ ircSignOn hostn (Nick tag nickn) ui lb . void . fork $ E.catch (readerLoop tag nickn sock) (\e@SomeException{} -> do- io $ hPutStrLn stderr $ "irc[" ++ tag ++ "] error: " ++ show e+ errorM (show e) remServer tag) readerLoop :: String -> String -> Handle -> LB ()@@ -138,9 +140,9 @@ then io $ hPutStr sock ("PONG " ++ drop 5 line' ++ "\r\n") else void . fork . void . timeout 15000000 $ received (decodeMessage tag nickn line') -sendMsg :: String -> Handle -> MVar () -> IrcMessage -> IO ()-sendMsg tag sock mv msg =+sendMsg :: Handle -> MVar () -> IrcMessage -> IO ()+sendMsg sock mv msg = E.catch (do takeMVar mv P.hPut sock $ P.pack $ encodeMessage msg "\r\n")- (\err -> do hPutStrLn stderr $ "irc[" ++ tag ++ "] error: " ++ show (err :: IOError)+ (\err -> do errorM (show (err :: IOError)) hClose sock)
src/Lambdabot/Plugin/Instances.hs view
@@ -16,11 +16,12 @@ > Int -} -module Lambdabot.Plugin.Instances (theModule) where+module Lambdabot.Plugin.Instances (instancesPlugin) where import Text.ParserCombinators.Parsec import Lambdabot.Plugin+import Lambdabot.Util import Control.Applicative ((*>)) import Control.Monad@@ -36,8 +37,8 @@ type ClassName = String type ModuleName = String -theModule :: Module ()-theModule = newModule+instancesPlugin :: Module ()+instancesPlugin = newModule { moduleCmds = return [ (command "instances") { help = say "instances <typeclass>. Fetch the instances of a typeclass."
src/Lambdabot/Plugin/Karma.hs view
@@ -1,5 +1,5 @@ -- | Karma-module Lambdabot.Plugin.Karma (theModule) where+module Lambdabot.Plugin.Karma (karmaPlugin) where import Lambdabot.Compat.FreenodeNick import Lambdabot.Plugin@@ -14,8 +14,8 @@ type KarmaState = M.Map Nick Integer type Karma = ModuleT KarmaState LB -theModule :: Module KarmaState-theModule = newModule+karmaPlugin :: Module KarmaState+karmaPlugin = newModule { moduleCmds = return [ (command "karma") { help = say "karma <polynick>. Return a person's karma value"
src/Lambdabot/Plugin/Localtime.hs view
@@ -4,7 +4,7 @@ -- GPL version 2 or later (see http://www.gnu.org/copyleft/gpl.html) -- | Simple wrapper over privmsg to get time information via the CTCP-module Lambdabot.Plugin.Localtime (theModule) where+module Lambdabot.Plugin.Localtime (localtimePlugin) where import Lambdabot.Plugin import Lambdabot (ircPrivmsg')@@ -13,8 +13,8 @@ type TimeMap = M.Map Nick -- the person who's time we requested [Nick] -- a list of targets waiting on this time -theModule :: Module TimeMap-theModule = newModule+localtimePlugin :: Module TimeMap+localtimePlugin = newModule { moduleDefState = return M.empty , moduleCmds = return
src/Lambdabot/Plugin/Log.hs view
@@ -5,7 +5,7 @@ -- -- | Logging an IRC channel.. ---module Lambdabot.Plugin.Log (theModule) where+module Lambdabot.Plugin.Log (logPlugin) where import Lambdabot import Lambdabot.Compat.FreenodeNick@@ -13,6 +13,7 @@ import qualified Lambdabot.Message as Msg import Lambdabot.Nick import Lambdabot.Plugin+import Lambdabot.Util import Control.Monad import qualified Data.Map as M@@ -50,8 +51,8 @@ -- * Dispatchers and Module instance declaration ---theModule :: Module (M.Map Channel ChanState)-theModule = newModule+logPlugin :: Module (M.Map Channel ChanState)+logPlugin = newModule { moduleDefState = return M.empty , moduleExit = cleanLogState , moduleInit = do
src/Lambdabot/Plugin/More.hs view
@@ -1,5 +1,5 @@ -- | Support for more(1) buffering-module Lambdabot.Plugin.More (theModule) where+module Lambdabot.Plugin.More (morePlugin) where import Lambdabot.Plugin import Lambdabot@@ -10,8 +10,8 @@ type More = ModuleT MoreState LB -- the @more state is handled centrally-theModule :: Module (GlobalPrivate () [String])-theModule = newModule+morePlugin :: Module (GlobalPrivate () [String])+morePlugin = newModule { moduleDefState = return $ mkGlobalPrivate 20 () , moduleInit = bindModule2 moreFilter
src/Lambdabot/Plugin/Numberwang.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE TypeFamilies #-} -module Lambdabot.Plugin.Numberwang where+module Lambdabot.Plugin.Numberwang (numberwangPlugin) where import Control.Applicative import Control.Monad@@ -21,8 +21,8 @@ conDist :: RVar Int conDist = poisson (32 :: Double) -theModule :: Module NumberwangState-theModule = newModule+numberwangPlugin :: Module NumberwangState+numberwangPlugin = newModule { moduleDefState = sample (State <$> cmdDist <*> conDist) , moduleCmds = return [ (command "numberwang")
src/Lambdabot/Plugin/OEIS.hs view
@@ -1,13 +1,13 @@ -- | Look up sequences in the Online Encyclopedia of Integer Sequences -- Based on the Math.OEIS library-module Lambdabot.Plugin.OEIS (theModule) where+module Lambdabot.Plugin.OEIS (oeisPlugin) where import Lambdabot.Plugin import Math.OEIS -theModule :: Module ()-theModule = newModule+oeisPlugin :: Module ()+oeisPlugin = newModule { moduleCmds = return [ (command "oeis") { aliases = ["sequence"]
src/Lambdabot/Plugin/OfflineRC.hs view
@@ -1,12 +1,13 @@ -- | Offline mode / RC file / -e support module. Handles spooling lists -- of commands (from haskeline, files, or the command line) into the vchat -- layer.-module Lambdabot.Plugin.OfflineRC ( theModule ) where+module Lambdabot.Plugin.OfflineRC ( offlineRC ) where import Lambdabot.Config.Core import Lambdabot.IRC import Lambdabot.Monad import Lambdabot.Plugin+import Lambdabot.Util import Control.Concurrent.Lifted import Control.Exception.Lifted ( evaluate, finally )@@ -24,8 +25,8 @@ type OfflineRCState = Integer type OfflineRC = ModuleT OfflineRCState LB -theModule :: Module OfflineRCState-theModule = newModule+offlineRC :: Module OfflineRCState+offlineRC = newModule { moduleDefState = return 0 , moduleInit = do void . fork $ do
src/Lambdabot/Plugin/Pl.hs view
@@ -7,9 +7,10 @@ -- Use more Arrow stuff -- -- TODO would be to plug into HaRe and use some of their refactorings.-module Lambdabot.Plugin.Pl (theModule) where+module Lambdabot.Plugin.Pl (plPlugin) where import Lambdabot.Plugin+import Lambdabot.Util import Lambdabot.Plugin.Pl.Common (TopLevel, mapTopLevel, getExpr) import Lambdabot.Plugin.Pl.Parser (parsePF)@@ -30,8 +31,8 @@ type PlState = GlobalPrivate () (Int, TopLevel) type Pl = ModuleT PlState LB -theModule :: Module (GlobalPrivate () (Int, TopLevel))-theModule = newModule+plPlugin :: Module (GlobalPrivate () (Int, TopLevel))+plPlugin = newModule { moduleDefState = return $ mkGlobalPrivate 15 () , moduleCmds = return
src/Lambdabot/Plugin/Pointful.hs view
@@ -1,5 +1,5 @@ -- Undo pointfree transformations. Plugin code derived from Pl.hs.-module Lambdabot.Plugin.Pointful (theModule) where+module Lambdabot.Plugin.Pointful (pointfulPlugin) where import Lambdabot.Module as Lmb (Module) import Lambdabot.Plugin@@ -12,8 +12,8 @@ import Data.Maybe import Language.Haskell.Exts as Hs -theModule :: Lmb.Module ()-theModule = newModule+pointfulPlugin :: Lmb.Module ()+pointfulPlugin = newModule { moduleCmds = return [ (command "pointful") { aliases = ["pointy","repoint","unpointless","unpl","unpf"]
src/Lambdabot/Plugin/Poll.hs view
@@ -6,7 +6,7 @@ -- | -- | added by Kenneth Hoste (boegel), 22/11/2005 -- | inspiration: Where plugin (thanks shapr,dons)-module Lambdabot.Plugin.Poll (theModule) where+module Lambdabot.Plugin.Poll (pollPlugin) where import Lambdabot.Plugin import qualified Data.ByteString.Char8 as P@@ -46,8 +46,8 @@ ------------------------------------------------------------------------ -theModule :: Module (M.Map PollName Poll)-theModule = newModule+pollPlugin :: Module (M.Map PollName Poll)+pollPlugin = newModule { moduleCmds = return [ (command "poll-list") { help = say "poll-list Shows all current polls"
src/Lambdabot/Plugin/Pretty.hs view
@@ -12,7 +12,7 @@ (c) Johannes Ahlmann, 2005-12-13, released under GPL 2 -} -module Lambdabot.Plugin.Pretty (theModule) where+module Lambdabot.Plugin.Pretty (prettyPlugin) where import Lambdabot.Plugin @@ -22,8 +22,8 @@ type Pretty = ModuleT () LB -theModule :: Module ()-theModule = newModule+prettyPlugin :: Module ()+prettyPlugin = newModule { moduleCmds = return [ (command "pretty") { help = say "pretty <expr>. Display haskell code in a pretty-printed manner"
src/Lambdabot/Plugin/Quote.hs view
@@ -1,8 +1,9 @@ {-# LANGUAGE CPP, PatternGuards #-} -- | Support for quotes-module Lambdabot.Plugin.Quote (theModule) where+module Lambdabot.Plugin.Quote (quotePlugin) where import Lambdabot.Plugin+import Lambdabot.Util import qualified Data.ByteString.Char8 as P import Data.Char@@ -16,8 +17,8 @@ type Quotes = M.Map Key [P.ByteString] type Quote = ModuleT Quotes LB -theModule :: Module (M.Map P.ByteString [P.ByteString])-theModule = newModule+quotePlugin :: Module (M.Map P.ByteString [P.ByteString])+quotePlugin = newModule { moduleSerialize = Just mapListPackedSerial , moduleDefState = return M.empty , moduleInit = modifyMS (M.filter (not . null))
src/Lambdabot/Plugin/Search.hs view
@@ -6,9 +6,10 @@ -- Joel Koerwer 11-01-2005 generalized query for different methods -- and added extractConversion to make things like @google 1+2 work-module Lambdabot.Plugin.Search (theModule) where+module Lambdabot.Plugin.Search (searchPlugin) where import Lambdabot.Plugin+import Lambdabot.Util import Lambdabot.Util.Browser import Data.Maybe@@ -51,8 +52,8 @@ googleUri = makeUri "www.google.com" "/search" -- wikipediaUri = makeUri "en.wikipedia.org" "/wiki/Special:Search" -theModule :: Module ()-theModule = newModule+searchPlugin :: Module ()+searchPlugin = newModule { moduleCmds = return [ (command name) { help = say (moduleHelp name)
src/Lambdabot/Plugin/Seen.hs view
@@ -3,15 +3,18 @@ -- GPL version 2 or later (see http://www.gnu.org/copyleft/gpl.html) -- | Keep track of IRC users.-module Lambdabot.Plugin.Seen (theModule) where+module Lambdabot.Plugin.Seen (seenPlugin) where import Lambdabot import Lambdabot.Compat.AltTime import Lambdabot.Compat.PackedNick import Lambdabot.IRC+import Lambdabot.Logging import qualified Lambdabot.Message as G import Lambdabot.Nick import Lambdabot.Plugin+import Lambdabot.Util+ import Lambdabot.Plugin.Seen.StopWatch import Lambdabot.Plugin.Seen.UserStatus @@ -24,7 +27,6 @@ import Data.Char import Data.List import qualified Data.Map as M-import System.IO import Text.Printf type SeenState = (MaxMap, SeenMap)@@ -35,8 +37,8 @@ ------------------------------------------------------------------------ -theModule :: Module (M.Map Channel Int, M.Map PackedNick UserStatus)-theModule = newModule+seenPlugin :: Module (M.Map Channel Int, M.Map PackedNick UserStatus)+seenPlugin = newModule { moduleDefState = return (M.empty,M.empty) , moduleCmds = return@@ -63,13 +65,12 @@ let ls = L.fromChunks [s] mbDecoded <- io . try . evaluate $ decode ls case mbDecoded of- Left exc -> do+ Left exc@SomeException{} -> do -- try reading the old format (slightly different type... oh, "binary"...) mbOld <- io . try . evaluate $ decode ls case mbOld of- Left exc2 -> do- let _ = exc2 :: SomeException- io $ hPutStrLn stderr ("WARNING: failed to read Seen module state: " ++ show (exc :: SomeException))+ Left SomeException{} ->+ warningM ("WARNING: failed to read Seen module state: " ++ show exc) Right (maxMap, seenMap) -> writeMS (M.mapKeys P.pack maxMap, seenMap) Right decoded -> writeMS decoded
src/Lambdabot/Plugin/Slap.hs view
@@ -1,12 +1,13 @@ -- | Support for quotes-module Lambdabot.Plugin.Slap (theModule) where+module Lambdabot.Plugin.Slap (slapPlugin) where import Lambdabot.Plugin+import Lambdabot.Util type Slap = ModuleT () LB -theModule :: Module ()-theModule = newModule+slapPlugin :: Module ()+slapPlugin = newModule { moduleCmds = return [ (command "slap") { aliases = ["smack"]
src/Lambdabot/Plugin/Source.hs view
@@ -1,16 +1,17 @@ -- Plugin.Source -- Display source for specified identifiers-module Lambdabot.Plugin.Source (theModule) where+module Lambdabot.Plugin.Source (sourcePlugin) where import Lambdabot.Plugin+import Lambdabot.Util import Control.Monad import qualified Data.ByteString.Char8 as P import qualified Data.Map as M type Env = M.Map P.ByteString P.ByteString -theModule :: Module (M.Map P.ByteString P.ByteString)-theModule = newModule+sourcePlugin :: Module (M.Map P.ByteString P.ByteString)+sourcePlugin = newModule { moduleCmds = return [ (command "src") { help = say helpStr
src/Lambdabot/Plugin/Spell.hs view
@@ -4,9 +4,10 @@ -- -- | Interface to /aspell/, an open source spelling checker, from a -- suggestion by Kai Engelhardt. Requires you to install aspell.-module Lambdabot.Plugin.Spell (theModule) where+module Lambdabot.Plugin.Spell (spellPlugin) where import Lambdabot.Plugin+import Lambdabot.Util import Control.Monad.Trans import Data.Char@@ -18,8 +19,8 @@ type Spell = ModuleT Bool LB -theModule :: Module Bool-theModule = newModule+spellPlugin :: Module Bool+spellPlugin = newModule { moduleCmds = return [ (command "spell") { help = say helpStr
src/Lambdabot/Plugin/Stats.hs view
@@ -1,16 +1,17 @@ {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE GADTs #-}-module Lambdabot.Plugin.Stats (theModule) where+module Lambdabot.Plugin.Stats (statsPlugin) where import Lambdabot.Plugin+import Lambdabot.Util import Network.StatsD type Stats = ModuleT StatsD LB -theModule :: Module StatsD-theModule = newModule+statsPlugin :: Module StatsD+statsPlugin = newModule { moduleDefState = io (openStatsD host port prefix) , contextual = \msg -> do let n = length msg
src/Lambdabot/Plugin/System.hs view
@@ -1,12 +1,13 @@ -- | System module : IRC control functions-module Lambdabot.Plugin.System (theModule) where+module Lambdabot.Plugin.System (system) where import Lambdabot+import Lambdabot.Compat.AltTime import Lambdabot.Compat.FreenodeNick import Lambdabot.IRC import Lambdabot.Monad import Lambdabot.Plugin-import Lambdabot.Compat.AltTime+import Lambdabot.Util import Control.Monad.State (gets, modify) import Control.Monad.Trans@@ -16,8 +17,8 @@ type SystemState = (ClockTime, TimeDiff) type System = ModuleT SystemState LB -theModule :: Module SystemState-theModule = newModule+system :: Module SystemState+system = newModule { moduleDefState = flip (,) noTimeDiff `fmap` io getClockTime , moduleSerialize = Just stdSerial
src/Lambdabot/Plugin/Tell.hs view
@@ -45,11 +45,12 @@ > hack away! -} -module Lambdabot.Plugin.Tell (theModule) where+module Lambdabot.Plugin.Tell (tellPlugin) where +import Lambdabot.Compat.AltTime import Lambdabot.Compat.FreenodeNick import Lambdabot.Plugin-import Lambdabot.Compat.AltTime+import Lambdabot.Util import Control.Arrow (first) import Control.Monad@@ -70,8 +71,8 @@ type Tell = ModuleT NoticeBoard LB -theModule :: Module NoticeBoard-theModule = newModule+tellPlugin :: Module NoticeBoard+tellPlugin = newModule { moduleCmds = return [ (command "tell") { help = say "tell <nick> <message>. When <nick> shows activity, tell them <message>."
src/Lambdabot/Plugin/Ticker.hs view
@@ -1,5 +1,5 @@ -- | Pull quotes down from yahoo.-module Lambdabot.Plugin.Ticker (theModule) where+module Lambdabot.Plugin.Ticker (tickerPlugin) where import Lambdabot.Plugin import Lambdabot.Util.Browser@@ -12,8 +12,8 @@ type Ticker = ModuleT () LB -theModule :: Module ()-theModule = newModule+tickerPlugin :: Module ()+tickerPlugin = newModule { moduleCmds = return [ (command "ticker") { help = say "ticker symbols. Look up quotes for symbols"
src/Lambdabot/Plugin/Todo.hs view
@@ -2,7 +2,7 @@ -- | A todo list -- -- (c) 2005 Samuel Bronson-module Lambdabot.Plugin.Todo (theModule) where+module Lambdabot.Plugin.Todo (todoPlugin) where import Lambdabot.Compat.PackedNick import Lambdabot.Plugin@@ -13,8 +13,8 @@ type TodoState = [(P.ByteString, P.ByteString)] type Todo = ModuleT TodoState LB -theModule :: Module TodoState-theModule = newModule+todoPlugin :: Module TodoState+todoPlugin = newModule { moduleDefState = return ([] :: TodoState) , moduleSerialize = Just assocListPackedSerial
src/Lambdabot/Plugin/Topic.hs view
@@ -3,11 +3,12 @@ -- The advantage of having the bot maintain the topic is that we get an -- authoritative source for the current topic, when the IRC server decides -- to delete it due to Network Splits.-module Lambdabot.Plugin.Topic (theModule) where+module Lambdabot.Plugin.Topic (topicPlugin) where -import Lambdabot.Plugin-import Lambdabot.Monad import Lambdabot.IRC+import Lambdabot.Monad+import Lambdabot.Plugin+import Lambdabot.Util import qualified Data.Map as M @@ -50,8 +51,8 @@ (alterListTopic (\_ _ -> [])) ] -theModule :: Module ()-theModule = newModule+topicPlugin :: Module ()+topicPlugin = newModule { moduleCmds = return [ (command name) { help = say helpStr
src/Lambdabot/Plugin/Type.hs view
@@ -16,19 +16,19 @@ -- -- Well, what do you know, this plugin enables lambdabot to automate -- that lookup for you and your fellow lambda hackers.-module Lambdabot.Plugin.Type (theModule, query_ghci) where+module Lambdabot.Plugin.Type (typePlugin, query_ghci) where import Lambdabot.Plugin- import Lambdabot.Plugin.Eval (exts)+import Lambdabot.Util import Data.Char import Data.Maybe import System.Process import Text.Regex.TDFA -theModule :: Module ()-theModule = newModule+typePlugin :: Module ()+typePlugin = newModule { moduleCmds = return [ (command "type") { help = say "type <expr>. Return the type of a value"
src/Lambdabot/Plugin/UnMtl.hs view
@@ -8,7 +8,7 @@ -- ---------------------------------------------------------------------- -module Lambdabot.Plugin.UnMtl (theModule) where+module Lambdabot.Plugin.UnMtl (unmtlPlugin) where import Lambdabot.Plugin import qualified Lambdabot.Plugin as Lmb (Module)@@ -17,8 +17,8 @@ import Control.Monad import Language.Haskell.Exts as Hs hiding (tuple, var) -theModule :: Lmb.Module ()-theModule = newModule+unmtlPlugin :: Lmb.Module ()+unmtlPlugin = newModule { moduleCmds = return [ (command "unmtl") { help = say "unroll mtl monads"
src/Lambdabot/Plugin/Undo.hs view
@@ -1,7 +1,7 @@ -- Copyright (c) 2006 Spencer Janssen -- GPL version 2 or later (see http://www.gnu.org/copyleft/gpl.html) -module Lambdabot.Plugin.Undo (theModule) where+module Lambdabot.Plugin.Undo (undoPlugin) where import Lambdabot.Plugin import Lambdabot.Util.Parser (withParsed)@@ -11,8 +11,8 @@ import qualified Data.Set as Set import Language.Haskell.Exts.Syntax hiding (Module) -theModule :: Module ()-theModule = newModule+undoPlugin :: Module ()+undoPlugin = newModule { moduleCmds = return [ (command "undo") { help = say "undo <expr>\nTranslate do notation to Monad operators."@@ -80,7 +80,7 @@ irrefutable PWildCard = True irrefutable (PAsPat _ p) = irrefutable p irrefutable (PParen p) = irrefutable p-irrefutable (PTuple ps) = all irrefutable ps+irrefutable (PTuple _box ps) = all irrefutable ps irrefutable _ = False infixed :: Exp -> String -> Exp -> Exp
src/Lambdabot/Plugin/Unlambda.hs view
@@ -4,14 +4,14 @@ -- | A plugin for the Haskell interpreter for the unlambda language -- -- http://www.madore.org/~david/programs/unlambda/-module Lambdabot.Plugin.Unlambda (theModule) where+module Lambdabot.Plugin.Unlambda (unlambdaPlugin) where import Lambdabot.Plugin import Lambdabot.Util.Process import Text.Regex.TDFA -theModule :: Module ()-theModule = newModule+unlambdaPlugin :: Module ()+unlambdaPlugin = newModule { moduleCmds = return [ (command "unlambda") { help = say "unlambda <expr>. Evaluate an unlambda expression"
src/Lambdabot/Plugin/Url.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE PatternGuards #-} -- | Fetch URL page titles of HTML links.-module Lambdabot.Plugin.Url (theModule) where+module Lambdabot.Plugin.Url (urlPlugin) where import Lambdabot.Plugin import Lambdabot.Util.Browser@@ -13,8 +13,8 @@ import Network.HTTP import Text.Regex.TDFA -theModule :: Module Bool-theModule = newModule+urlPlugin :: Module Bool+urlPlugin = newModule { moduleCmds = return [ (command "url-title") { help = say "url-title <url>. Fetch the page title."
src/Lambdabot/Plugin/Version.hs view
@@ -2,14 +2,14 @@ -- GPL version 2 or later (see http://www.gnu.org/copyleft/gpl.html) -- | Lambdabot version information-module Lambdabot.Plugin.Version (theModule) where+module Lambdabot.Plugin.Version (versionPlugin) where import Lambdabot.Plugin import Paths_lambdabot (version) import Data.Version (showVersion) -theModule :: Module ()-theModule = newModule+versionPlugin :: Module ()+versionPlugin = newModule { moduleCmds = return [ (command "version") { help = say $
src/Lambdabot/Plugin/Vixen.hs view
@@ -3,9 +3,10 @@ -- (c) Mark Wotton -- Serialisation (c) 2007 Don Stewart -module Lambdabot.Plugin.Vixen (theModule) where+module Lambdabot.Plugin.Vixen (vixenPlugin) where import Lambdabot.Plugin+import Lambdabot.Util import Control.Arrow ((***)) import Control.Monad@@ -14,8 +15,8 @@ import System.Directory import Text.Regex.TDFA -theModule :: Module (Bool, String -> IO [Char])-theModule = newModule+vixenPlugin :: Module (Bool, String -> IO [Char])+vixenPlugin = newModule { moduleCmds = return [ (command "vixen") { help = say "vixen <phrase>. Sergeant Curry's lonely hearts club"
src/Lambdabot/Plugin/Where.hs view
@@ -6,9 +6,10 @@ -- -- Slightly specialised version of Where for associating projects with their urls. -- Code almost all copied.-module Lambdabot.Plugin.Where (theModule) where+module Lambdabot.Plugin.Where (wherePlugin) where import Lambdabot.Plugin+import Lambdabot.Util import qualified Data.ByteString.Char8 as P import Data.Char import qualified Data.Map as M@@ -17,8 +18,8 @@ type WhereWriter = WhereState -> Cmd Where () type Where = ModuleT WhereState LB -theModule :: Module (M.Map P.ByteString P.ByteString)-theModule = newModule+wherePlugin :: Module (M.Map P.ByteString P.ByteString)+wherePlugin = newModule { moduleDefState = return M.empty , moduleSerialize = Just mapPackedSerial