lambdabot-misc-plugins (empty) → 5.0
raw patch · 11 files changed
+876/−0 lines, 11 filesdep +SafeSemaphoredep +basedep +bytestringsetup-changed
Dependencies added: SafeSemaphore, base, bytestring, containers, filepath, hstatsd, lambdabot-core, lifted-base, monad-control, mtl, network, network-uri, parsec, process, random, random-fu, random-source, regex-tdfa, split, tagsoup, template-haskell, time, transformers, transformers-base, unix, utf8-string, zlib
Files
- LICENSE +22/−0
- Setup.hs +3/−0
- lambdabot-misc-plugins.cabal +82/−0
- src/Lambdabot/Plugin/Misc.hs +20/−0
- src/Lambdabot/Plugin/Misc/Dummy.hs +114/−0
- src/Lambdabot/Plugin/Misc/Dummy/DocAssocs.hs +430/−0
- src/Lambdabot/Plugin/Misc/Error.hs +33/−0
- src/Lambdabot/Plugin/Misc/Fresh.hs +36/−0
- src/Lambdabot/Plugin/Misc/Hello.hs +18/−0
- src/Lambdabot/Plugin/Misc/Stats.hs +45/−0
- src/Lambdabot/Plugin/Misc/Todo.hs +73/−0
+ LICENSE view
@@ -0,0 +1,22 @@+Copyright (c) 2003 Andrew J. Bromage+Portions Copyright (c) 2003 Shae Erisson, Sven M. Hallberg, Taylor Campbell+Portions Copyright (c) 2003-2006 Members of the AUTHORS file++Permission is hereby granted, free of charge, to any person obtaining+a copy of this software and associated documentation files (the+"Software"), to deal in the Software without restriction, including+without limitation the rights to use, copy, modify, merge, publish,+distribute, sublicense, and/or sell copies of the Software, and to+permit persons to whom the Software is furnished to do so, subject+to the following conditions:++The above copyright notice and this permission notice shall be included+in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY+KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ Setup.hs view
@@ -0,0 +1,3 @@+#!/usr/bin/env runhaskell+import Distribution.Simple+main = defaultMainWithHooks defaultUserHooks
+ lambdabot-misc-plugins.cabal view
@@ -0,0 +1,82 @@+name: lambdabot-misc-plugins+version: 5.0++license: GPL+license-file: LICENSE++author: Don Stewart+maintainer: James Cook <mokus@deepbondi.net>++category: Development, Web+synopsis: Lambdabot miscellaneous plugins +description: Lambdabot is an IRC bot written over several years by+ those on the #haskell IRC channel.+ .+ Provided plugins:+ .+ [dummy] Many commands with fixed replies.+ [error] Debug error handling.+ [fresh] Generate Haskell project names.+ [hello] Hello, world.+ [stats] Ad-hoc statsd queries.+ [todo] A to-do list for lambdabot.++homepage: http://haskell.org/haskellwiki/Lambdabot++build-type: Simple+cabal-version: >= 1.8+tested-with: GHC == 7.6.3, GHC == 7.8.3++source-repository head+ type: git+ location: https://github.com/lambdabot/lambdabot.git++flag network-uri+ description: Get Network.URI from the network-uri package+ default: True++library+ hs-source-dirs: src+ ghc-options: -Wall+ -funbox-strict-fields++ exposed-modules: Lambdabot.Plugin.Misc+ other-modules: Lambdabot.Plugin.Misc.Dummy+ Lambdabot.Plugin.Misc.Error+ Lambdabot.Plugin.Misc.Fresh+ Lambdabot.Plugin.Misc.Hello+ Lambdabot.Plugin.Misc.Stats+ Lambdabot.Plugin.Misc.Todo++ other-modules: Lambdabot.Plugin.Misc.Dummy.DocAssocs++ build-depends: base >= 4.4 && < 5,+ bytestring >= 0.9,+ containers >= 0.4,+ filepath >= 1.3,+ hstatsd >= 0.1,+ lambdabot-core >= 5 && < 5.1,+ lifted-base >= 0.2,+ monad-control >= 0.3 && < 1,+ mtl >= 2,+ time >= 1.4,+ parsec >= 3,+ process >= 1.1,+ random >= 1,+ random-fu >= 0.2,+ random-source >= 0.3,+ regex-tdfa >= 1.1,+ SafeSemaphore >= 0.9,+ split >= 0.2,+ tagsoup >= 0.12,+ template-haskell >= 2.7,+ transformers >= 0.2,+ transformers-base >= 0.4,+ unix >= 2.5,+ utf8-string >= 0.3,+ zlib >= 0.5++ if flag(network-uri)+ build-depends: network-uri >= 2.6, network >= 2.6+ else+ build-depends: network-uri < 2.6, network < 2.6
+ src/Lambdabot/Plugin/Misc.hs view
@@ -0,0 +1,20 @@+module Lambdabot.Plugin.Misc+ ( dummyPlugin+ , errorPlugin+ , freshPlugin+ , helloPlugin+ , statsPlugin+ , todoPlugin+ + , miscPlugins+ ) where++import Lambdabot.Plugin.Misc.Dummy+import Lambdabot.Plugin.Misc.Error+import Lambdabot.Plugin.Misc.Fresh+import Lambdabot.Plugin.Misc.Hello+import Lambdabot.Plugin.Misc.Stats+import Lambdabot.Plugin.Misc.Todo++miscPlugins :: [String]+miscPlugins = ["dummy", "error", "fresh", "hello", "stats", "todo"]
+ src/Lambdabot/Plugin/Misc/Dummy.hs view
@@ -0,0 +1,114 @@+-- | Simple template module+-- Contains many constant bot commands.+module Lambdabot.Plugin.Misc.Dummy (dummyPlugin) where++import Lambdabot.Plugin+import Lambdabot.Plugin.Misc.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++dummyPlugin :: Module ()+dummyPlugin = newModule+ { moduleCmds = return+ $ (command "eval")+ { help = say "eval. Do nothing (perversely)"+ , process = const (return ())+ }+ : (command "choose")+ { help = say "choose. Lambdabot featuring AI power"+ , process = \args ->+ if null args then say "Choose between what?"+ else say =<< (io . random . words $ args)+ }+ : [ (command cmd)+ { help = say (dummyHelp cmd)+ , process = mapM_ say . lines . op+ }+ | (cmd, op) <- dummylst+ ]++ , contextual = \msg -> case msg of+ "lisppaste2: url" -> say "Haskell pastebin: http://lpaste.net/"+ _ -> return ()+ }++dummyHelp :: String -> String+dummyHelp s = case s of+ "dummy" -> "dummy. Print a string constant"+ "bug" -> "bug. Submit a bug to GHC's trac"+ "id" -> "id <arg>. The identity plugin"+ "show" -> "show <foo>. Print \"<foo>\""+ "wiki" -> "wiki <page>. URLs of Haskell wiki pages"+ "paste" -> "paste. Paste page url"+ "docs" -> "docs <lib>. Lookup the url for this library's documentation"+ "learn" -> "learn. The learning page url"+ "haskellers" -> "haskellers. Find other Haskell users"+ "botsnack" -> "botsnack. Feeds the bot a snack"+ "get-shapr" -> "get-shapr. Summon shapr instantly"+ "shootout" -> "shootout. The debian language shootout"+ "faq" -> "faq. Answer frequently asked questions about Haskell"+ "googleit" -> "letmegooglethatforyou."+ "hackage" -> "find stuff on hackage"+ _ -> "I'm sorry Dave, I'm affraid I don't know that command"++dummylst :: [(String, String -> String)]+dummylst =+ [("dummy" , const "dummy")+ ,("bug" , const "http://hackage.haskell.org/trac/ghc/newticket?type=bug")+ ,("id" , (' ' :) . id)+ ,("show" , show)+ ,("wiki" , lookupWiki)+ ,("paste" , const "Haskell pastebin: http://lpaste.net/")+ ,("docs" , \x -> if null x+ then docPrefix </> "index.html"+ else lookupPackage docPrefix '-' "html" x)+ ,("learn" , const "http://www.haskell.org/haskellwiki/Learning_Haskell")+ ,("haskellers" , const "http://www.haskellers.com/")+ ,("botsnack" , const ":)")+ ,("get-shapr" , const "shapr!!")+ ,("shootout" , const "http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all")+ ,("faq" , const "The answer is: Yes! Haskell can do that.")+ ,("googleit" , lookupGoogle)+ ,("hackage" , lookupHackage)+ ,("thanks" , const "you are welcome")+ ,("thx" , const "you are welcome")+ ,("thank you" , const "you are welcome")+ ,("ping" , const "pong")+ ,("tic-tac-toe", const "how about a nice game of chess?")+ ]++lookupWiki :: String -> String+lookupWiki page = "http://www.haskell.org/haskellwiki" </> spacesToUnderscores page+ where spacesToUnderscores = map (\c -> if c == ' ' then '_' else c)++lookupHackage :: String -> String+lookupHackage "" = "http://hackage.haskell.org"+lookupHackage xs = "http://hackage.haskell.org/package" </> xs++googlePrefix :: String+googlePrefix = "http://letmegooglethatforyou.com"++lookupGoogle :: String -> String+lookupGoogle "" = googlePrefix+lookupGoogle xs = googlePrefix </> "?q=" ++ quote xs+ where+ quote = map (\x -> if x == ' ' then '+' else x)++docPrefix :: String+docPrefix = "http://haskell.org/ghc/docs/latest/html/libraries"++lookupPackage :: String -> Char -> String -> String -> String+lookupPackage begin sep end x'' = + case M.lookup (P.pack x') docAssocs of+ Nothing -> strip isSpace x'' ++ " not available"+ Just (x, m) -> begin+ </> P.unpack m+ </> map (choice (=='.') (const sep) id) (P.unpack x)+ <.> end+ where + choice p f g = p >>= \b -> if b then f else g+ x' = map toLower (strip isSpace x'')
+ src/Lambdabot/Plugin/Misc/Dummy/DocAssocs.hs view
@@ -0,0 +1,430 @@+-- autogenerated+module Lambdabot.Plugin.Misc.Dummy.DocAssocs (docAssocs) where+import qualified Data.Map as M+import qualified Data.ByteString.Char8 as P+v1 :: P.ByteString+v1 = P.pack "Cabal"+v2 :: P.ByteString+v2 = P.pack "Win32"+v3 :: P.ByteString+v3 = P.pack "array"+v4 :: P.ByteString+v4 = P.pack "base"+v5 :: P.ByteString+v5 = P.pack "bin-package-db"+v6 :: P.ByteString+v6 = P.pack "binary"+v7 :: P.ByteString+v7 = P.pack "bytestring"+v8 :: P.ByteString+v8 = P.pack "containers"+v9 :: P.ByteString+v9 = P.pack "deepseq"+v10 :: P.ByteString+v10 = P.pack "directory"+v11 :: P.ByteString+v11 = P.pack "filepath"+v12 :: P.ByteString+v12 = P.pack "ghc-prim"+v13 :: P.ByteString+v13 = P.pack "haskell2010"+v14 :: P.ByteString+v14 = P.pack "haskell98"+v15 :: P.ByteString+v15 = P.pack "hoopl"+v16 :: P.ByteString+v16 = P.pack "hpc"+v17 :: P.ByteString+v17 = P.pack "integer-gmp"+v18 :: P.ByteString+v18 = P.pack "old-locale"+v19 :: P.ByteString+v19 = P.pack "old-time"+v20 :: P.ByteString+v20 = P.pack "pretty"+v21 :: P.ByteString+v21 = P.pack "process"+v22 :: P.ByteString+v22 = P.pack "template-haskell"+v23 :: P.ByteString+v23 = P.pack "time"+v24 :: P.ByteString+v24 = P.pack "unix"+docAssocs :: M.Map P.ByteString (P.ByteString, P.ByteString)+docAssocs = {-# SCC "Dummy.DocAssocs" #-} M.fromList+ [(P.pack "array" , (P.pack "Array", v14)),+ (P.pack "bits" , (P.pack "Bits", v14)),+ (P.pack "cerror" , (P.pack "CError", v14)),+ (P.pack "cforeign" , (P.pack "CForeign", v14)),+ (P.pack "cputime" , (P.pack "CPUTime", v14)),+ (P.pack "cstring" , (P.pack "CString", v14)),+ (P.pack "ctypes" , (P.pack "CTypes", v14)),+ (P.pack "char" , (P.pack "Char", v14)),+ (P.pack "compiler.hoopl" , (P.pack "Compiler.Hoopl", v15)),+ (P.pack "compiler.hoopl.internals" , (P.pack "Compiler.Hoopl.Internals", v15)),+ (P.pack "compiler.hoopl.passes.dlist" , (P.pack "Compiler.Hoopl.Passes.DList", v15)),+ (P.pack "compiler.hoopl.passes.dominator" , (P.pack "Compiler.Hoopl.Passes.Dominator", v15)),+ (P.pack "compiler.hoopl.wrappers" , (P.pack "Compiler.Hoopl.Wrappers", v15)),+ (P.pack "complex" , (P.pack "Complex", v14)),+ (P.pack "control.applicative" , (P.pack "Control.Applicative", v4)),+ (P.pack "control.arrow" , (P.pack "Control.Arrow", v4)),+ (P.pack "control.category" , (P.pack "Control.Category", v4)),+ (P.pack "control.concurrent" , (P.pack "Control.Concurrent", v4)),+ (P.pack "control.concurrent.chan" , (P.pack "Control.Concurrent.Chan", v4)),+ (P.pack "control.concurrent.mvar" , (P.pack "Control.Concurrent.MVar", v4)),+ (P.pack "control.concurrent.qsem" , (P.pack "Control.Concurrent.QSem", v4)),+ (P.pack "control.concurrent.qsemn" , (P.pack "Control.Concurrent.QSemN", v4)),+ (P.pack "control.concurrent.samplevar" , (P.pack "Control.Concurrent.SampleVar", v4)),+ (P.pack "control.deepseq" , (P.pack "Control.DeepSeq", v9)),+ (P.pack "control.exception" , (P.pack "Control.Exception", v4)),+ (P.pack "control.exception.base" , (P.pack "Control.Exception.Base", v4)),+ (P.pack "control.monad" , (P.pack "Control.Monad", v4)),+ (P.pack "control.monad.fix" , (P.pack "Control.Monad.Fix", v4)),+ (P.pack "control.monad.instances" , (P.pack "Control.Monad.Instances", v4)),+ (P.pack "control.monad.st" , (P.pack "Control.Monad.ST", v4)),+ (P.pack "control.monad.st.lazy" , (P.pack "Control.Monad.ST.Lazy", v4)),+ (P.pack "control.monad.st.lazy.safe" , (P.pack "Control.Monad.ST.Lazy.Safe", v4)),+ (P.pack "control.monad.st.lazy.unsafe" , (P.pack "Control.Monad.ST.Lazy.Unsafe", v4)),+ (P.pack "control.monad.st.safe" , (P.pack "Control.Monad.ST.Safe", v4)),+ (P.pack "control.monad.st.strict" , (P.pack "Control.Monad.ST.Strict", v4)),+ (P.pack "control.monad.st.unsafe" , (P.pack "Control.Monad.ST.Unsafe", v4)),+ (P.pack "control.monad.zip" , (P.pack "Control.Monad.Zip", v4)),+ (P.pack "data.array" , (P.pack "Data.Array", v3)),+ (P.pack "data.array.iarray" , (P.pack "Data.Array.IArray", v3)),+ (P.pack "data.array.io" , (P.pack "Data.Array.IO", v3)),+ (P.pack "data.array.io.safe" , (P.pack "Data.Array.IO.Safe", v3)),+ (P.pack "data.array.marray" , (P.pack "Data.Array.MArray", v3)),+ (P.pack "data.array.marray.safe" , (P.pack "Data.Array.MArray.Safe", v3)),+ (P.pack "data.array.st" , (P.pack "Data.Array.ST", v3)),+ (P.pack "data.array.st.safe" , (P.pack "Data.Array.ST.Safe", v3)),+ (P.pack "data.array.storable" , (P.pack "Data.Array.Storable", v3)),+ (P.pack "data.array.storable.safe" , (P.pack "Data.Array.Storable.Safe", v3)),+ (P.pack "data.array.unboxed" , (P.pack "Data.Array.Unboxed", v3)),+ (P.pack "data.array.unsafe" , (P.pack "Data.Array.Unsafe", v3)),+ (P.pack "data.binary" , (P.pack "Data.Binary", v6)),+ (P.pack "data.binary.builder" , (P.pack "Data.Binary.Builder", v6)),+ (P.pack "data.binary.builder.internal" , (P.pack "Data.Binary.Builder.Internal", v6)),+ (P.pack "data.binary.get" , (P.pack "Data.Binary.Get", v6)),+ (P.pack "data.binary.put" , (P.pack "Data.Binary.Put", v6)),+ (P.pack "data.bits" , (P.pack "Data.Bits", v4)),+ (P.pack "data.bool" , (P.pack "Data.Bool", v4)),+ (P.pack "data.bytestring" , (P.pack "Data.ByteString", v7)),+ (P.pack "data.bytestring.char8" , (P.pack "Data.ByteString.Char8", v7)),+ (P.pack "data.bytestring.lazy" , (P.pack "Data.ByteString.Lazy", v7)),+ (P.pack "data.bytestring.lazy.builder" , (P.pack "Data.ByteString.Lazy.Builder", v7)),+ (P.pack "data.bytestring.lazy.builder.ascii" , (P.pack "Data.ByteString.Lazy.Builder.ASCII", v7)),+ (P.pack "data.bytestring.lazy.builder.extras" , (P.pack "Data.ByteString.Lazy.Builder.Extras", v7)),+ (P.pack "data.bytestring.lazy.char8" , (P.pack "Data.ByteString.Lazy.Char8", v7)),+ (P.pack "data.bytestring.unsafe" , (P.pack "Data.ByteString.Unsafe", v7)),+ (P.pack "data.char" , (P.pack "Data.Char", v4)),+ (P.pack "data.complex" , (P.pack "Data.Complex", v4)),+ (P.pack "data.data" , (P.pack "Data.Data", v4)),+ (P.pack "data.dynamic" , (P.pack "Data.Dynamic", v4)),+ (P.pack "data.either" , (P.pack "Data.Either", v4)),+ (P.pack "data.eq" , (P.pack "Data.Eq", v4)),+ (P.pack "data.fixed" , (P.pack "Data.Fixed", v4)),+ (P.pack "data.foldable" , (P.pack "Data.Foldable", v4)),+ (P.pack "data.function" , (P.pack "Data.Function", v4)),+ (P.pack "data.functor" , (P.pack "Data.Functor", v4)),+ (P.pack "data.graph" , (P.pack "Data.Graph", v8)),+ (P.pack "data.hashtable" , (P.pack "Data.HashTable", v4)),+ (P.pack "data.ioref" , (P.pack "Data.IORef", v4)),+ (P.pack "data.int" , (P.pack "Data.Int", v4)),+ (P.pack "data.intmap" , (P.pack "Data.IntMap", v8)),+ (P.pack "data.intmap.lazy" , (P.pack "Data.IntMap.Lazy", v8)),+ (P.pack "data.intmap.strict" , (P.pack "Data.IntMap.Strict", v8)),+ (P.pack "data.intset" , (P.pack "Data.IntSet", v8)),+ (P.pack "data.ix" , (P.pack "Data.Ix", v4)),+ (P.pack "data.list" , (P.pack "Data.List", v4)),+ (P.pack "data.map" , (P.pack "Data.Map", v8)),+ (P.pack "data.map.lazy" , (P.pack "Data.Map.Lazy", v8)),+ (P.pack "data.map.strict" , (P.pack "Data.Map.Strict", v8)),+ (P.pack "data.maybe" , (P.pack "Data.Maybe", v4)),+ (P.pack "data.monoid" , (P.pack "Data.Monoid", v4)),+ (P.pack "data.ord" , (P.pack "Data.Ord", v4)),+ (P.pack "data.ratio" , (P.pack "Data.Ratio", v4)),+ (P.pack "data.stref" , (P.pack "Data.STRef", v4)),+ (P.pack "data.stref.lazy" , (P.pack "Data.STRef.Lazy", v4)),+ (P.pack "data.stref.strict" , (P.pack "Data.STRef.Strict", v4)),+ (P.pack "data.sequence" , (P.pack "Data.Sequence", v8)),+ (P.pack "data.set" , (P.pack "Data.Set", v8)),+ (P.pack "data.string" , (P.pack "Data.String", v4)),+ (P.pack "data.time" , (P.pack "Data.Time", v23)),+ (P.pack "data.time.calendar" , (P.pack "Data.Time.Calendar", v23)),+ (P.pack "data.time.calendar.easter" , (P.pack "Data.Time.Calendar.Easter", v23)),+ (P.pack "data.time.calendar.julian" , (P.pack "Data.Time.Calendar.Julian", v23)),+ (P.pack "data.time.calendar.monthday" , (P.pack "Data.Time.Calendar.MonthDay", v23)),+ (P.pack "data.time.calendar.ordinaldate" , (P.pack "Data.Time.Calendar.OrdinalDate", v23)),+ (P.pack "data.time.calendar.weekdate" , (P.pack "Data.Time.Calendar.WeekDate", v23)),+ (P.pack "data.time.clock" , (P.pack "Data.Time.Clock", v23)),+ (P.pack "data.time.clock.posix" , (P.pack "Data.Time.Clock.POSIX", v23)),+ (P.pack "data.time.clock.tai" , (P.pack "Data.Time.Clock.TAI", v23)),+ (P.pack "data.time.format" , (P.pack "Data.Time.Format", v23)),+ (P.pack "data.time.localtime" , (P.pack "Data.Time.LocalTime", v23)),+ (P.pack "data.traversable" , (P.pack "Data.Traversable", v4)),+ (P.pack "data.tree" , (P.pack "Data.Tree", v8)),+ (P.pack "data.tuple" , (P.pack "Data.Tuple", v4)),+ (P.pack "data.typeable" , (P.pack "Data.Typeable", v4)),+ (P.pack "data.typeable.internal" , (P.pack "Data.Typeable.Internal", v4)),+ (P.pack "data.unique" , (P.pack "Data.Unique", v4)),+ (P.pack "data.version" , (P.pack "Data.Version", v4)),+ (P.pack "data.word" , (P.pack "Data.Word", v4)),+ (P.pack "debug.trace" , (P.pack "Debug.Trace", v4)),+ (P.pack "directory" , (P.pack "Directory", v14)),+ (P.pack "distribution.compat.readp" , (P.pack "Distribution.Compat.ReadP", v1)),+ (P.pack "distribution.compiler" , (P.pack "Distribution.Compiler", v1)),+ (P.pack "distribution.installedpackageinfo" , (P.pack "Distribution.InstalledPackageInfo", v1)),+ (P.pack "distribution.installedpackageinfo.binary" , (P.pack "Distribution.InstalledPackageInfo.Binary", v5)),+ (P.pack "distribution.license" , (P.pack "Distribution.License", v1)),+ (P.pack "distribution.make" , (P.pack "Distribution.Make", v1)),+ (P.pack "distribution.modulename" , (P.pack "Distribution.ModuleName", v1)),+ (P.pack "distribution.package" , (P.pack "Distribution.Package", v1)),+ (P.pack "distribution.packagedescription" , (P.pack "Distribution.PackageDescription", v1)),+ (P.pack "distribution.packagedescription.check" , (P.pack "Distribution.PackageDescription.Check", v1)),+ (P.pack "distribution.packagedescription.configuration" , (P.pack "Distribution.PackageDescription.Configuration", v1)),+ (P.pack "distribution.packagedescription.parse" , (P.pack "Distribution.PackageDescription.Parse", v1)),+ (P.pack "distribution.packagedescription.prettyprint" , (P.pack "Distribution.PackageDescription.PrettyPrint", v1)),+ (P.pack "distribution.parseutils" , (P.pack "Distribution.ParseUtils", v1)),+ (P.pack "distribution.reade" , (P.pack "Distribution.ReadE", v1)),+ (P.pack "distribution.simple" , (P.pack "Distribution.Simple", v1)),+ (P.pack "distribution.simple.bench" , (P.pack "Distribution.Simple.Bench", v1)),+ (P.pack "distribution.simple.build" , (P.pack "Distribution.Simple.Build", v1)),+ (P.pack "distribution.simple.build.macros" , (P.pack "Distribution.Simple.Build.Macros", v1)),+ (P.pack "distribution.simple.build.pathsmodule" , (P.pack "Distribution.Simple.Build.PathsModule", v1)),+ (P.pack "distribution.simple.buildpaths" , (P.pack "Distribution.Simple.BuildPaths", v1)),+ (P.pack "distribution.simple.command" , (P.pack "Distribution.Simple.Command", v1)),+ (P.pack "distribution.simple.compiler" , (P.pack "Distribution.Simple.Compiler", v1)),+ (P.pack "distribution.simple.configure" , (P.pack "Distribution.Simple.Configure", v1)),+ (P.pack "distribution.simple.ghc" , (P.pack "Distribution.Simple.GHC", v1)),+ (P.pack "distribution.simple.haddock" , (P.pack "Distribution.Simple.Haddock", v1)),+ (P.pack "distribution.simple.hpc" , (P.pack "Distribution.Simple.Hpc", v1)),+ (P.pack "distribution.simple.hugs" , (P.pack "Distribution.Simple.Hugs", v1)),+ (P.pack "distribution.simple.install" , (P.pack "Distribution.Simple.Install", v1)),+ (P.pack "distribution.simple.installdirs" , (P.pack "Distribution.Simple.InstallDirs", v1)),+ (P.pack "distribution.simple.jhc" , (P.pack "Distribution.Simple.JHC", v1)),+ (P.pack "distribution.simple.lhc" , (P.pack "Distribution.Simple.LHC", v1)),+ (P.pack "distribution.simple.localbuildinfo" , (P.pack "Distribution.Simple.LocalBuildInfo", v1)),+ (P.pack "distribution.simple.nhc" , (P.pack "Distribution.Simple.NHC", v1)),+ (P.pack "distribution.simple.packageindex" , (P.pack "Distribution.Simple.PackageIndex", v1)),+ (P.pack "distribution.simple.preprocess" , (P.pack "Distribution.Simple.PreProcess", v1)),+ (P.pack "distribution.simple.preprocess.unlit" , (P.pack "Distribution.Simple.PreProcess.Unlit", v1)),+ (P.pack "distribution.simple.program" , (P.pack "Distribution.Simple.Program", v1)),+ (P.pack "distribution.simple.program.ar" , (P.pack "Distribution.Simple.Program.Ar", v1)),+ (P.pack "distribution.simple.program.builtin" , (P.pack "Distribution.Simple.Program.Builtin", v1)),+ (P.pack "distribution.simple.program.db" , (P.pack "Distribution.Simple.Program.Db", v1)),+ (P.pack "distribution.simple.program.ghc" , (P.pack "Distribution.Simple.Program.GHC", v1)),+ (P.pack "distribution.simple.program.hcpkg" , (P.pack "Distribution.Simple.Program.HcPkg", v1)),+ (P.pack "distribution.simple.program.hpc" , (P.pack "Distribution.Simple.Program.Hpc", v1)),+ (P.pack "distribution.simple.program.ld" , (P.pack "Distribution.Simple.Program.Ld", v1)),+ (P.pack "distribution.simple.program.run" , (P.pack "Distribution.Simple.Program.Run", v1)),+ (P.pack "distribution.simple.program.script" , (P.pack "Distribution.Simple.Program.Script", v1)),+ (P.pack "distribution.simple.program.types" , (P.pack "Distribution.Simple.Program.Types", v1)),+ (P.pack "distribution.simple.register" , (P.pack "Distribution.Simple.Register", v1)),+ (P.pack "distribution.simple.setup" , (P.pack "Distribution.Simple.Setup", v1)),+ (P.pack "distribution.simple.srcdist" , (P.pack "Distribution.Simple.SrcDist", v1)),+ (P.pack "distribution.simple.test" , (P.pack "Distribution.Simple.Test", v1)),+ (P.pack "distribution.simple.uhc" , (P.pack "Distribution.Simple.UHC", v1)),+ (P.pack "distribution.simple.userhooks" , (P.pack "Distribution.Simple.UserHooks", v1)),+ (P.pack "distribution.simple.utils" , (P.pack "Distribution.Simple.Utils", v1)),+ (P.pack "distribution.system" , (P.pack "Distribution.System", v1)),+ (P.pack "distribution.testsuite" , (P.pack "Distribution.TestSuite", v1)),+ (P.pack "distribution.text" , (P.pack "Distribution.Text", v1)),+ (P.pack "distribution.verbosity" , (P.pack "Distribution.Verbosity", v1)),+ (P.pack "distribution.version" , (P.pack "Distribution.Version", v1)),+ (P.pack "foreign" , (P.pack "Foreign", v4)),+ (P.pack "foreign.c" , (P.pack "Foreign.C", v4)),+ (P.pack "foreign.c.error" , (P.pack "Foreign.C.Error", v4)),+ (P.pack "foreign.c.string" , (P.pack "Foreign.C.String", v4)),+ (P.pack "foreign.c.types" , (P.pack "Foreign.C.Types", v4)),+ (P.pack "foreign.concurrent" , (P.pack "Foreign.Concurrent", v4)),+ (P.pack "foreign.foreignptr" , (P.pack "Foreign.ForeignPtr", v13)),+ (P.pack "foreign.foreignptr.safe" , (P.pack "Foreign.ForeignPtr.Safe", v4)),+ (P.pack "foreign.foreignptr.unsafe" , (P.pack "Foreign.ForeignPtr.Unsafe", v4)),+ (P.pack "foreign.marshal" , (P.pack "Foreign.Marshal", v4)),+ (P.pack "foreign.marshal.alloc" , (P.pack "Foreign.Marshal.Alloc", v4)),+ (P.pack "foreign.marshal.array" , (P.pack "Foreign.Marshal.Array", v4)),+ (P.pack "foreign.marshal.error" , (P.pack "Foreign.Marshal.Error", v4)),+ (P.pack "foreign.marshal.pool" , (P.pack "Foreign.Marshal.Pool", v4)),+ (P.pack "foreign.marshal.safe" , (P.pack "Foreign.Marshal.Safe", v4)),+ (P.pack "foreign.marshal.unsafe" , (P.pack "Foreign.Marshal.Unsafe", v4)),+ (P.pack "foreign.marshal.utils" , (P.pack "Foreign.Marshal.Utils", v4)),+ (P.pack "foreign.ptr" , (P.pack "Foreign.Ptr", v4)),+ (P.pack "foreign.safe" , (P.pack "Foreign.Safe", v4)),+ (P.pack "foreign.stableptr" , (P.pack "Foreign.StablePtr", v4)),+ (P.pack "foreign.storable" , (P.pack "Foreign.Storable", v4)),+ (P.pack "foreignptr" , (P.pack "ForeignPtr", v14)),+ (P.pack "ghc.cstring" , (P.pack "GHC.CString", v12)),+ (P.pack "ghc.char" , (P.pack "GHC.Char", v4)),+ (P.pack "ghc.conc" , (P.pack "GHC.Conc", v4)),+ (P.pack "ghc.conc.io" , (P.pack "GHC.Conc.IO", v4)),+ (P.pack "ghc.conc.signal" , (P.pack "GHC.Conc.Signal", v4)),+ (P.pack "ghc.conc.sync" , (P.pack "GHC.Conc.Sync", v4)),+ (P.pack "ghc.consolehandler" , (P.pack "GHC.ConsoleHandler", v4)),+ (P.pack "ghc.constants" , (P.pack "GHC.Constants", v4)),+ (P.pack "ghc.debug" , (P.pack "GHC.Debug", v12)),+ (P.pack "ghc.desugar" , (P.pack "GHC.Desugar", v4)),+ (P.pack "ghc.environment" , (P.pack "GHC.Environment", v4)),+ (P.pack "ghc.event" , (P.pack "GHC.Event", v4)),+ (P.pack "ghc.exts" , (P.pack "GHC.Exts", v4)),+ (P.pack "ghc.fingerprint" , (P.pack "GHC.Fingerprint", v4)),+ (P.pack "ghc.fingerprint.type" , (P.pack "GHC.Fingerprint.Type", v4)),+ (P.pack "ghc.foreign" , (P.pack "GHC.Foreign", v4)),+ (P.pack "ghc.generics" , (P.pack "GHC.Generics", v4)),+ (P.pack "ghc.io.buffer" , (P.pack "GHC.IO.Buffer", v4)),+ (P.pack "ghc.io.bufferedio" , (P.pack "GHC.IO.BufferedIO", v4)),+ (P.pack "ghc.io.device" , (P.pack "GHC.IO.Device", v4)),+ (P.pack "ghc.io.encoding" , (P.pack "GHC.IO.Encoding", v4)),+ (P.pack "ghc.io.encoding.codepage" , (P.pack "GHC.IO.Encoding.CodePage", v4)),+ (P.pack "ghc.io.encoding.failure" , (P.pack "GHC.IO.Encoding.Failure", v4)),+ (P.pack "ghc.io.encoding.iconv" , (P.pack "GHC.IO.Encoding.Iconv", v4)),+ (P.pack "ghc.io.encoding.latin1" , (P.pack "GHC.IO.Encoding.Latin1", v4)),+ (P.pack "ghc.io.encoding.types" , (P.pack "GHC.IO.Encoding.Types", v4)),+ (P.pack "ghc.io.encoding.utf16" , (P.pack "GHC.IO.Encoding.UTF16", v4)),+ (P.pack "ghc.io.encoding.utf32" , (P.pack "GHC.IO.Encoding.UTF32", v4)),+ (P.pack "ghc.io.encoding.utf8" , (P.pack "GHC.IO.Encoding.UTF8", v4)),+ (P.pack "ghc.io.handle" , (P.pack "GHC.IO.Handle", v4)),+ (P.pack "ghc.io.handle.fd" , (P.pack "GHC.IO.Handle.FD", v4)),+ (P.pack "ghc.ip" , (P.pack "GHC.IP", v4)),+ (P.pack "ghc.integer.gmp.internals" , (P.pack "GHC.Integer.GMP.Internals", v17)),+ (P.pack "ghc.integer.logarithms" , (P.pack "GHC.Integer.Logarithms", v17)),+ (P.pack "ghc.magic" , (P.pack "GHC.Magic", v12)),+ (P.pack "ghc.prim" , (P.pack "GHC.Prim", v12)),+ (P.pack "ghc.primopwrappers" , (P.pack "GHC.PrimopWrappers", v12)),+ (P.pack "ghc.stack" , (P.pack "GHC.Stack", v4)),+ (P.pack "ghc.stats" , (P.pack "GHC.Stats", v4)),+ (P.pack "ghc.tuple" , (P.pack "GHC.Tuple", v12)),+ (P.pack "ghc.typelits" , (P.pack "GHC.TypeLits", v4)),+ (P.pack "ghc.types" , (P.pack "GHC.Types", v12)),+ (P.pack "graphics.win32" , (P.pack "Graphics.Win32", v2)),+ (P.pack "graphics.win32.control" , (P.pack "Graphics.Win32.Control", v2)),+ (P.pack "graphics.win32.dialogue" , (P.pack "Graphics.Win32.Dialogue", v2)),+ (P.pack "graphics.win32.gdi" , (P.pack "Graphics.Win32.GDI", v2)),+ (P.pack "graphics.win32.gdi.bitmap" , (P.pack "Graphics.Win32.GDI.Bitmap", v2)),+ (P.pack "graphics.win32.gdi.brush" , (P.pack "Graphics.Win32.GDI.Brush", v2)),+ (P.pack "graphics.win32.gdi.clip" , (P.pack "Graphics.Win32.GDI.Clip", v2)),+ (P.pack "graphics.win32.gdi.font" , (P.pack "Graphics.Win32.GDI.Font", v2)),+ (P.pack "graphics.win32.gdi.graphics2d" , (P.pack "Graphics.Win32.GDI.Graphics2D", v2)),+ (P.pack "graphics.win32.gdi.hdc" , (P.pack "Graphics.Win32.GDI.HDC", v2)),+ (P.pack "graphics.win32.gdi.palette" , (P.pack "Graphics.Win32.GDI.Palette", v2)),+ (P.pack "graphics.win32.gdi.path" , (P.pack "Graphics.Win32.GDI.Path", v2)),+ (P.pack "graphics.win32.gdi.pen" , (P.pack "Graphics.Win32.GDI.Pen", v2)),+ (P.pack "graphics.win32.gdi.region" , (P.pack "Graphics.Win32.GDI.Region", v2)),+ (P.pack "graphics.win32.gdi.types" , (P.pack "Graphics.Win32.GDI.Types", v2)),+ (P.pack "graphics.win32.icon" , (P.pack "Graphics.Win32.Icon", v2)),+ (P.pack "graphics.win32.key" , (P.pack "Graphics.Win32.Key", v2)),+ (P.pack "graphics.win32.menu" , (P.pack "Graphics.Win32.Menu", v2)),+ (P.pack "graphics.win32.message" , (P.pack "Graphics.Win32.Message", v2)),+ (P.pack "graphics.win32.misc" , (P.pack "Graphics.Win32.Misc", v2)),+ (P.pack "graphics.win32.resource" , (P.pack "Graphics.Win32.Resource", v2)),+ (P.pack "graphics.win32.window" , (P.pack "Graphics.Win32.Window", v2)),+ (P.pack "io" , (P.pack "IO", v14)),+ (P.pack "int" , (P.pack "Int", v14)),+ (P.pack "ix" , (P.pack "Ix", v14)),+ (P.pack "language.haskell.extension" , (P.pack "Language.Haskell.Extension", v1)),+ (P.pack "language.haskell.th" , (P.pack "Language.Haskell.TH", v22)),+ (P.pack "language.haskell.th.lib" , (P.pack "Language.Haskell.TH.Lib", v22)),+ (P.pack "language.haskell.th.ppr" , (P.pack "Language.Haskell.TH.Ppr", v22)),+ (P.pack "language.haskell.th.pprlib" , (P.pack "Language.Haskell.TH.PprLib", v22)),+ (P.pack "language.haskell.th.quote" , (P.pack "Language.Haskell.TH.Quote", v22)),+ (P.pack "language.haskell.th.syntax" , (P.pack "Language.Haskell.TH.Syntax", v22)),+ (P.pack "list" , (P.pack "List", v14)),+ (P.pack "locale" , (P.pack "Locale", v14)),+ (P.pack "marshalalloc" , (P.pack "MarshalAlloc", v14)),+ (P.pack "marshalarray" , (P.pack "MarshalArray", v14)),+ (P.pack "marshalerror" , (P.pack "MarshalError", v14)),+ (P.pack "marshalutils" , (P.pack "MarshalUtils", v14)),+ (P.pack "maybe" , (P.pack "Maybe", v14)),+ (P.pack "monad" , (P.pack "Monad", v14)),+ (P.pack "numeric" , (P.pack "Numeric", v4)),+ (P.pack "prelude" , (P.pack "Prelude", v4)),+ (P.pack "ptr" , (P.pack "Ptr", v14)),+ (P.pack "random" , (P.pack "Random", v14)),+ (P.pack "ratio" , (P.pack "Ratio", v14)),+ (P.pack "stableptr" , (P.pack "StablePtr", v14)),+ (P.pack "storable" , (P.pack "Storable", v14)),+ (P.pack "system" , (P.pack "System", v14)),+ (P.pack "system.cputime" , (P.pack "System.CPUTime", v4)),+ (P.pack "system.cmd" , (P.pack "System.Cmd", v21)),+ (P.pack "system.console.getopt" , (P.pack "System.Console.GetOpt", v4)),+ (P.pack "system.directory" , (P.pack "System.Directory", v10)),+ (P.pack "system.environment" , (P.pack "System.Environment", v4)),+ (P.pack "system.exit" , (P.pack "System.Exit", v4)),+ (P.pack "system.filepath" , (P.pack "System.FilePath", v11)),+ (P.pack "system.filepath.posix" , (P.pack "System.FilePath.Posix", v11)),+ (P.pack "system.filepath.windows" , (P.pack "System.FilePath.Windows", v11)),+ (P.pack "system.io" , (P.pack "System.IO", v4)),+ (P.pack "system.io.error" , (P.pack "System.IO.Error", v4)),+ (P.pack "system.io.unsafe" , (P.pack "System.IO.Unsafe", v4)),+ (P.pack "system.info" , (P.pack "System.Info", v4)),+ (P.pack "system.locale" , (P.pack "System.Locale", v18)),+ (P.pack "system.mem" , (P.pack "System.Mem", v4)),+ (P.pack "system.mem.stablename" , (P.pack "System.Mem.StableName", v4)),+ (P.pack "system.mem.weak" , (P.pack "System.Mem.Weak", v4)),+ (P.pack "system.posix" , (P.pack "System.Posix", v24)),+ (P.pack "system.posix.bytestring" , (P.pack "System.Posix.ByteString", v24)),+ (P.pack "system.posix.bytestring.filepath" , (P.pack "System.Posix.ByteString.FilePath", v24)),+ (P.pack "system.posix.directory" , (P.pack "System.Posix.Directory", v24)),+ (P.pack "system.posix.directory.bytestring" , (P.pack "System.Posix.Directory.ByteString", v24)),+ (P.pack "system.posix.dynamiclinker" , (P.pack "System.Posix.DynamicLinker", v24)),+ (P.pack "system.posix.dynamiclinker.bytestring" , (P.pack "System.Posix.DynamicLinker.ByteString", v24)),+ (P.pack "system.posix.dynamiclinker.module" , (P.pack "System.Posix.DynamicLinker.Module", v24)),+ (P.pack "system.posix.dynamiclinker.module.bytestring" , (P.pack "System.Posix.DynamicLinker.Module.ByteString", v24)),+ (P.pack "system.posix.dynamiclinker.prim" , (P.pack "System.Posix.DynamicLinker.Prim", v24)),+ (P.pack "system.posix.env" , (P.pack "System.Posix.Env", v24)),+ (P.pack "system.posix.env.bytestring" , (P.pack "System.Posix.Env.ByteString", v24)),+ (P.pack "system.posix.error" , (P.pack "System.Posix.Error", v24)),+ (P.pack "system.posix.files" , (P.pack "System.Posix.Files", v24)),+ (P.pack "system.posix.files.bytestring" , (P.pack "System.Posix.Files.ByteString", v24)),+ (P.pack "system.posix.io" , (P.pack "System.Posix.IO", v24)),+ (P.pack "system.posix.io.bytestring" , (P.pack "System.Posix.IO.ByteString", v24)),+ (P.pack "system.posix.process" , (P.pack "System.Posix.Process", v24)),+ (P.pack "system.posix.process.bytestring" , (P.pack "System.Posix.Process.ByteString", v24)),+ (P.pack "system.posix.process.internals" , (P.pack "System.Posix.Process.Internals", v24)),+ (P.pack "system.posix.resource" , (P.pack "System.Posix.Resource", v24)),+ (P.pack "system.posix.semaphore" , (P.pack "System.Posix.Semaphore", v24)),+ (P.pack "system.posix.sharedmem" , (P.pack "System.Posix.SharedMem", v24)),+ (P.pack "system.posix.signals" , (P.pack "System.Posix.Signals", v24)),+ (P.pack "system.posix.signals.exts" , (P.pack "System.Posix.Signals.Exts", v24)),+ (P.pack "system.posix.temp" , (P.pack "System.Posix.Temp", v24)),+ (P.pack "system.posix.temp.bytestring" , (P.pack "System.Posix.Temp.ByteString", v24)),+ (P.pack "system.posix.terminal" , (P.pack "System.Posix.Terminal", v24)),+ (P.pack "system.posix.terminal.bytestring" , (P.pack "System.Posix.Terminal.ByteString", v24)),+ (P.pack "system.posix.time" , (P.pack "System.Posix.Time", v24)),+ (P.pack "system.posix.types" , (P.pack "System.Posix.Types", v4)),+ (P.pack "system.posix.unistd" , (P.pack "System.Posix.Unistd", v24)),+ (P.pack "system.posix.user" , (P.pack "System.Posix.User", v24)),+ (P.pack "system.process" , (P.pack "System.Process", v21)),+ (P.pack "system.time" , (P.pack "System.Time", v19)),+ (P.pack "system.timeout" , (P.pack "System.Timeout", v4)),+ (P.pack "system.win32" , (P.pack "System.Win32", v2)),+ (P.pack "system.win32.console" , (P.pack "System.Win32.Console", v2)),+ (P.pack "system.win32.dll" , (P.pack "System.Win32.DLL", v2)),+ (P.pack "system.win32.debugapi" , (P.pack "System.Win32.DebugApi", v2)),+ (P.pack "system.win32.file" , (P.pack "System.Win32.File", v2)),+ (P.pack "system.win32.filemapping" , (P.pack "System.Win32.FileMapping", v2)),+ (P.pack "system.win32.info" , (P.pack "System.Win32.Info", v2)),+ (P.pack "system.win32.mem" , (P.pack "System.Win32.Mem", v2)),+ (P.pack "system.win32.nls" , (P.pack "System.Win32.NLS", v2)),+ (P.pack "system.win32.process" , (P.pack "System.Win32.Process", v2)),+ (P.pack "system.win32.registry" , (P.pack "System.Win32.Registry", v2)),+ (P.pack "system.win32.security" , (P.pack "System.Win32.Security", v2)),+ (P.pack "system.win32.shell" , (P.pack "System.Win32.Shell", v2)),+ (P.pack "system.win32.simplemapi" , (P.pack "System.Win32.SimpleMAPI", v2)),+ (P.pack "system.win32.time" , (P.pack "System.Win32.Time", v2)),+ (P.pack "system.win32.types" , (P.pack "System.Win32.Types", v2)),+ (P.pack "text.parsercombinators.readp" , (P.pack "Text.ParserCombinators.ReadP", v4)),+ (P.pack "text.parsercombinators.readprec" , (P.pack "Text.ParserCombinators.ReadPrec", v4)),+ (P.pack "text.prettyprint" , (P.pack "Text.PrettyPrint", v20)),+ (P.pack "text.prettyprint.hughespj" , (P.pack "Text.PrettyPrint.HughesPJ", v20)),+ (P.pack "text.printf" , (P.pack "Text.Printf", v4)),+ (P.pack "text.read" , (P.pack "Text.Read", v4)),+ (P.pack "text.read.lex" , (P.pack "Text.Read.Lex", v4)),+ (P.pack "text.show" , (P.pack "Text.Show", v4)),+ (P.pack "text.show.functions" , (P.pack "Text.Show.Functions", v4)),+ (P.pack "time" , (P.pack "Time", v14)),+ (P.pack "trace.hpc.mix" , (P.pack "Trace.Hpc.Mix", v16)),+ (P.pack "trace.hpc.reflect" , (P.pack "Trace.Hpc.Reflect", v16)),+ (P.pack "trace.hpc.tix" , (P.pack "Trace.Hpc.Tix", v16)),+ (P.pack "trace.hpc.util" , (P.pack "Trace.Hpc.Util", v16)),+ (P.pack "unsafe.coerce" , (P.pack "Unsafe.Coerce", v4)),+ (P.pack "word" , (P.pack "Word", v14))]
+ src/Lambdabot/Plugin/Misc/Error.hs view
@@ -0,0 +1,33 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE GADTs #-}+{-# LANGUAGE TemplateHaskell #-}+{-# OPTIONS_GHC -fno-warn-overlapping-patterns #-}+module Lambdabot.Plugin.Misc.Error (errorPlugin, failOnLoad, errorOnLoad) where++import Lambdabot.Config+import Lambdabot.Plugin++import Control.Monad++config "failOnLoad" [t| Bool |] [| False |]+config "errorOnLoad" [t| Bool |] [| False |]++errorPlugin :: Module ()+errorPlugin = newModule+ { moduleCmds = return+ [ (command "error")+ { help = say "Throw an error, see what lambdabot does with it!"+ , process = error . show+ }+ , (command "fail")+ { help = say "Throw an error, see what lambdabot does with it!"+ , process = fail . show+ }+ ]+ , moduleInit = do+ shouldFail <- getConfig failOnLoad+ when shouldFail (fail "Error module hates the world!")+ + shouldError <- getConfig errorOnLoad+ when shouldError (error "Error module hates the world!")+ }
+ src/Lambdabot/Plugin/Misc/Fresh.hs view
@@ -0,0 +1,36 @@+-- | Haskell project name generation+-- semi-joke+module Lambdabot.Plugin.Misc.Fresh (freshPlugin) where++import Lambdabot.Plugin++import Control.Monad.Trans+import Data.Char++type Fresh = ModuleT Integer LB++freshPlugin :: Module Integer+freshPlugin = newModule+ { moduleDefState = return 0+ , moduleSerialize = Just stdSerial+ + , moduleCmds = return+ [ (command "freshname")+ { help = say "freshname. Return a unique Haskell project name."+ , process = \_ -> lift fresh >>= say+ }+ ]+ }++fresh :: Fresh String+fresh = withMS $ \n f -> do+ f (n+1)+ return ("Ha" ++ reverse (asName n))++asName :: Integer -> String+asName i+ | i == 0 = [chr (ord 'a')]+ | r == 0 = [chr (ord 'a' + (fromIntegral a))]+ | otherwise = chr (ord 'a' + (fromIntegral a)) : asName r+ where+ (r,a) = i `quotRem` 26
+ src/Lambdabot/Plugin/Misc/Hello.hs view
@@ -0,0 +1,18 @@+--+-- | Hello world plugin+--+module Lambdabot.Plugin.Misc.Hello (helloPlugin) where++import Lambdabot.Plugin++helloPlugin :: Module ()+helloPlugin = newModule+ { moduleCmds = return+ [ (command "hello")+ { aliases = ["goodbye"]+ , help = say "hello/goodbye <arg>. Simplest possible plugin"+ , process = \xs -> say ("Hello world. " ++ xs)+ }+ ]+ }+
+ src/Lambdabot/Plugin/Misc/Stats.hs view
@@ -0,0 +1,45 @@+{-# LANGUAGE ConstraintKinds #-}+{-# LANGUAGE GADTs #-}+module Lambdabot.Plugin.Misc.Stats (statsPlugin) where++import Lambdabot.Plugin+import Lambdabot.Util++import Network.StatsD+++type Stats = ModuleT StatsD LB++statsPlugin :: Module StatsD+statsPlugin = newModule+ { moduleDefState = io (openStatsD host port prefix)+ , contextual = \msg -> do+ let n = length msg++ user <- showNick =<< getSender+ chan <- showNick =<< getTarget++ counts+ [ (grp ++ [stat'], val')+ | grp <- [["user", user], ["channel", chan]]+ , (stat', val') <- [("lines", 1), ("chars", toInteger n) ]+ ]+ }++-- various helpers+host :: String+host = "stats.thecave.lan"++port :: String+port = "8125"++prefix :: [String]+prefix = ["lambdabot"]++report :: [Stat] -> Cmd Stats ()+report xs = do+ st <- readMS+ io (push st xs)++counts :: [([String], Integer)] -> Cmd Stats ()+counts xs = report [stat bucket' val' "c" Nothing | (bucket', val') <- xs]
+ src/Lambdabot/Plugin/Misc/Todo.hs view
@@ -0,0 +1,73 @@+{-# LANGUAGE PatternGuards #-}+-- | A todo list+--+-- (c) 2005 Samuel Bronson+module Lambdabot.Plugin.Misc.Todo (todoPlugin) where++import Lambdabot.Compat.PackedNick+import Lambdabot.Plugin+import Control.Monad+import qualified Data.ByteString.Char8 as P++-- A list of key/elem pairs with an ordering determined by its position in the list+type TodoState = [(P.ByteString, P.ByteString)]+type Todo = ModuleT TodoState LB++todoPlugin :: Module TodoState+todoPlugin = newModule+ { moduleDefState = return ([] :: TodoState)+ , moduleSerialize = Just assocListPackedSerial++ , moduleCmds = return+ [ (command "todo")+ { help = say "todo. List todo entries"+ , process = getTodo+ }+ , (command "todo-add")+ { help = say "todo-add <idea>. Add a todo entry"+ , process = addTodo+ }+ , (command "todo-delete")+ { privileged = True+ , help = say "todo-delete <n>. Delete a todo entry (for admins)"+ , process = delTodo+ }+ ]+ }++-- | Print todo list+getTodo :: String -> Cmd Todo ()+getTodo [] = readMS >>= sayTodo+getTodo _ = say "@todo has no args, try @todo-add or @list todo"++-- | Pretty print todo list+sayTodo :: [(P.ByteString, P.ByteString)] -> Cmd Todo ()+sayTodo [] = say "Nothing to do!"+sayTodo todoList = say . unlines =<< zipWithM fmtTodoItem ([0..] :: [Int]) todoList+ where+ fmtTodoItem n (idea, nick_) = do+ nick <- showNick (unpackNick nick_)+ return $ concat $+ [ show n,". ", nick ,": ",P.unpack idea ]++-- | Add new entry to list+addTodo :: String -> Cmd Todo ()+addTodo rest = do+ sender <- fmap packNick getSender+ modifyMS (++[(P.pack rest, sender)])+ say "Entry added to the todo list"++-- | Delete an entry from the list+delTodo :: String -> Cmd Todo ()+delTodo rest+ | Just n <- readM rest = say =<< withMS (\ls write -> case () of+ _ | null ls -> return "Todo list is empty"+ | n > length ls - 1 || n < 0+ -> return (show n ++ " is out of range")++ | otherwise -> do+ write (map snd . filter ((/= n) . fst) . zip [0..] $ ls)+ let (a,_) = ls !! n+ return ("Removed: " ++ P.unpack a))++ | otherwise = say "Syntax error. @todo <n>, where n :: Int"