Lambdabot is an IRC bot written over several years by those on the #haskell IRC channel.
It operates as a command line tool, embedded in an editor, embedded in GHCi, via internet relay chat and on the web.
A friendly IRC bot and apprentice coder, written in Haskell.
The "binary" package is quite fragile, it'd be nice to have something more robust. Possibilities include cereal, aeson, proporty-list, persistent, anything really. Some goals:
Lambdabot throws an exception upon quiting:
lambdabot> quit
Main: caught (and ignoring) Data.Binary.Get.runGet at position 0: demandInput: not enough bytes
Quit
Exception: all servers detached
exception:
Data.Binary.Get.runGet at position 0: demandInput: not enough bytes
This seems independent from Issue #1. The relevant part here is Exception: all servers detached
. When the user quits by pressing Ctrl+D there's an additional exception <stdin>: hGetLine: end of file
Currently lambdabot has no integration with readline
or haskeline
. We should add it to make lambdabot more user-friendly. John Wiegely provided a patch for it here, but applying it causes type errors in replLoop
function:
replLoop :: InputT OfflineRC ()
replLoop = do
line <- getInputLine "lambdabot> "
s' <- case line of Nothing -> fail "<eof>"
Just x -> return $ dropWhile isSpace x
when (not $ null s') $ do
modifyHistory (addHistory s')
lift $ feed s'
continue <- lift $ gets ircStayConnected
when continue replLoop
This produces:
src/Plugin/OfflineRC.hs:89:13:
No instance for (MonadException OfflineRC)
arising from a use of `getInputLine'
Possible fix:
add an instance declaration for (MonadException OfflineRC)
In a stmt of a 'do' block: line <- getInputLine "lambdabot> "
Currently lambdabot repository stores four external packages:
This is not a good way to organize a project. These directories aren't even used in the build process! We should create a separate repository for each of these packages so they can be developed independently of lambdabot and then we should remove them from the lambabot repository.
I'm not sure about the lambdabot-trusted
. What does it do? Perhaps it could be merged into lambdabot package?
On Fedora 18 (x86_64), I removed ~/.ghc and ~/.cabal and did:
$ sudo yum install readline-devel
$ cabal update
$ cabal install cabal-install
$ cabal install lambdabot
It fails with ExitFailure 139. Any suggestions?
=== ERROR ===
...
Building lambdabot-4.2.3.3...
Preprocessing executable 'lambdabot' for lambdabot-4.2.3.3...
Plugin/Pl/Common.hs:1:12:
Warning: The -fvia-C flag does nothing; it will be removed in a future GHC release
Plugin/Pl/RuleLib.hs:1:16:
Warning: -fglasgow-exts is deprecated: Use individual extensions instead
[ 1 of 79] Compiling Plugin.Dict.DictLookup ( Plugin/Dict/DictLookup.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Dict/DictLookup.o )
Plugin/Dict/DictLookup.hs:22:1:
Warning: Module `Control.OldException' is deprecated:
Future versions of base will not support the old exceptions style. Please switch to extensible exceptions.
Plugin/Dict/DictLookup.hs:22:30:
Warning: In the use of `handle'
(imported from Control.OldException):
Deprecated: "Future versions of base will not support the old exceptions style. Please switch to extensible exceptions."
[ 2 of 79] Compiling Plugin.Dummy.DocAssocs ( Plugin/Dummy/DocAssocs.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Dummy/DocAssocs.o )
[ 3 of 79] Compiling Plugin.Free.Util ( Plugin/Free/Util.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Free/Util.o )
[ 4 of 79] Compiling Plugin.Free.Parse ( Plugin/Free/Parse.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Free/Parse.o )
[ 5 of 79] Compiling Plugin.Free.Type ( Plugin/Free/Type.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Free/Type.o )
[ 6 of 79] Compiling Plugin.Free.Expr ( Plugin/Free/Expr.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Free/Expr.o )
[ 7 of 79] Compiling Plugin.Free.Theorem ( Plugin/Free/Theorem.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Free/Theorem.o )
[ 8 of 79] Compiling Plugin.Free.FreeTheorem ( Plugin/Free/FreeTheorem.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Free/FreeTheorem.o )
[ 9 of 79] Compiling Plugin.Pl.Common ( Plugin/Pl/Common.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Pl/Common.o )
[10 of 79] Compiling Plugin.Pl.Parser ( Plugin/Pl/Parser.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Pl/Parser.o )
[11 of 79] Compiling Plugin.Pl.PrettyPrinter ( Plugin/Pl/PrettyPrinter.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Pl/PrettyPrinter.o )
[12 of 79] Compiling Plugin.Pl.Transform ( Plugin/Pl/Transform.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Pl/Transform.o )
[13 of 79] Compiling Plugin.Pl.Names ( Plugin/Pl/Names.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Pl/Names.o )
[14 of 79] Compiling Plugin.Pl.RuleLib ( Plugin/Pl/RuleLib.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Pl/RuleLib.o )
[15 of 79] Compiling Plugin.Pl.Rules ( Plugin/Pl/Rules.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Pl/Rules.o )
[16 of 79] Compiling Plugin.Pl.Optimize ( Plugin/Pl/Optimize.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Pl/Optimize.o )
[17 of 79] Compiling Plugin.Quote.Text ( Plugin/Quote/Text.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Quote/Text.o )
[18 of 79] Compiling Config ( Config.hs, dist/build/lambdabot/lambdabot-tmp/Config.o )
[19 of 79] Compiling Plugin.Quote.Fortune ( Plugin/Quote/Fortune.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Quote/Fortune.o )
Plugin/Quote/Fortune.hs:13:1:
Warning: Module `Control.OldException' is deprecated:
Future versions of base will not support the old exceptions style. Please switch to extensible exceptions.
Plugin/Quote/Fortune.hs:13:45:
Warning: In the use of `C.catch'
(imported from Control.OldException):
Deprecated: "Future versions of base will not support the old exceptions style. Please switch to extensible exceptions."
[20 of 79] Compiling Paths_lambdabot ( dist/build/autogen/Paths_lambdabot.hs, dist/build/lambdabot/lambdabot-tmp/Paths_lambdabot.o )
[21 of 79] Compiling Shared ( Shared.hs, dist/build/lambdabot/lambdabot-tmp/Shared.o )
[22 of 79] Compiling Message ( Message.hs, dist/build/lambdabot/lambdabot-tmp/Message.o )
[23 of 79] Compiling IRCBase ( IRCBase.hs, dist/build/lambdabot/lambdabot-tmp/IRCBase.o )
[24 of 79] Compiling File ( File.hs, dist/build/lambdabot/lambdabot-tmp/File.o )
[25 of 79] Compiling Lambdabot ( Lambdabot.hs, dist/build/lambdabot/lambdabot-tmp/Lambdabot.o )
Lambdabot.hs:72:1:
Warning: Module `Control.OldException' is deprecated:
Future versions of base will not support the old exceptions style. Please switch to extensible exceptions.
Lambdabot.hs:72:1:
Warning: In the use of type constructor or class `Exception'
(imported from Control.OldException):
Deprecated: "Future versions of base will not support the old exceptions style. Please switch to extensible exceptions."
Lambdabot.hs:72:1:
Warning: In the use of data constructor `ErrorCall'
(imported from Control.OldException):
Deprecated: "Future versions of base will not support the old exceptions style. Please switch to extensible exceptions."
Lambdabot.hs:72:1:
Warning: In the use of `catch'
(imported from Control.OldException):
Deprecated: "Future versions of base will not support the old exceptions style. Please switch to extensible exceptions."
Lambdabot.hs:72:1:
Warning: In the use of `try'
(imported from Control.OldException):
Deprecated: "Future versions of base will not support the old exceptions style. Please switch to extensible exceptions."
Lambdabot.hs:72:1:
Warning: In the use of `catchDyn'
(imported from Control.OldException):
Deprecated: "Future versions of base will not support the old exceptions style. Please switch to extensible exceptions."
Lambdabot.hs:72:1:
Warning: In the use of `throwDyn'
(imported from Control.OldException):
Deprecated: "Future versions of base will not support the old exceptions style. Please switch to extensible exceptions."
[26 of 79] Compiling LBState ( LBState.hs, dist/build/lambdabot/lambdabot-tmp/LBState.o )
[27 of 79] Compiling Plugin ( Plugin.hs, dist/build/lambdabot/lambdabot-tmp/Plugin.o )
[28 of 79] Compiling Plugin.Activity ( Plugin/Activity.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Activity.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package Boolean-0.1.2 ... linking ... done.
Loading package array-0.4.0.0 ... linking ... done.
Loading package deepseq-1.3.0.1 ... linking ... done.
Loading package containers-0.5.2.1 ... linking ... done.
Loading package nats-0.1 ... linking ... done.
Loading package semigroups-0.9 ... linking ... done.
Loading package void-0.5.11 ... linking ... done.
Loading package MemoTrie-0.6.1 ... linking ... done.
Loading package NumInstances-1.0 ... linking ... done.
Loading package vector-space-0.8.6 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package mtl-2.1.2 ... linking ... done.
Loading package bytestring-0.9.2.1 ... linking ... done.
Loading package unix-2.5.1.0 ... linking ... done.
Loading package unlambda-0.1.3 ... linking ... done.
Loading package old-locale-1.0.0.4 ... linking ... done.
Loading package time-1.4.0.2 ... linking ... done.
Loading package random-1.0.1.1 ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package QuickCheck-2.5.1.1 ... linking ... done.
Loading package simple-reflect-0.3.1 ... linking ... done.
Loading package logict-0.6 ... linking ... done.
Loading package smallcheck-1.0.1 ... linking ... done.
Loading package syb-0.3.7 ... linking ... done.
Loading package show-0.5 ... linking ... done.
Loading package filepath-1.3.0.0 ... linking ... done.
Loading package old-time-1.1.0.0 ... linking ... done.
Loading package directory-1.1.0.2 ... linking ... done.
Loading package process-1.1.0.2 ... linking ... done.
Loading package readline-1.0.3.0 ... linking ... done.
Loading package text-0.11.2.3 ... linking ... done.
Loading package parsec-3.1.3 ... linking ... done.
Loading package network-2.4.1.2 ... linking ... done.
Loading package HTTP-4000.2.8 ... linking ... done.
Loading package oeis-0.3.1 ... linking ... done.
Loading package numbers-3000.1.0.1 ... linking ... done.
Loading package binary-0.7.0.1 ... linking ... done.
Loading package haskell-src-1.0.1.5 ... linking ... done.
Loading package regex-base-0.93.2 ... linking ... done.
Loading package regex-posix-0.95.2 ... linking ... done.
Loading package regex-compat-0.95.1 ... linking ... done.
Loading package tagsoup-0.12.8 ... linking ... done.
Loading package utf8-string-0.3.7 ... linking ... done.
Loading package zlib-0.5.4.1 ... linking ... done.
Loading package lambdabot-utils-4.2.2 ... linking ... done.
Loading package cpphs-1.14 ... linking ... done.
Loading package haskell-src-exts-1.13.3 ... linking ... done.
Loading package data-inttrie-0.0.8 ... linking ... done.
Loading package data-memocombinators-0.4.4 ... linking ... done.
Loading package brainfuck-0.1 ... linking ... done.
Loading package lazysmallcheck-0.6 ... linking ... done.
Loading package Stream-0.4.6.1 ... linking ... done.
Loading package arrows-0.4.4.1 ... linking ... done.
Loading package MonadRandom-0.1.8 ... linking ... done.
Loading package IOSpec-0.2.5 ... linking ... done.
Plugin/Activity.hs:10:1:
Warning: Module `Control.OldException' is deprecated:
Future versions of base will not support the old exceptions style. Please switch to extensible exceptions.
[29 of 79] Compiling Plugin.Babel ( Plugin/Babel.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Babel.o )
[30 of 79] Compiling Plugin.Base ( Plugin/Base.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Base.o )
Plugin/Base.hs:15:1:
Warning: Module `Control.OldException' is deprecated:
Future versions of base will not support the old exceptions style. Please switch to extensible exceptions.
Plugin/Base.hs:15:30:
Warning: In the use of data constructor `NoMethodError'
(imported from Control.OldException):
Deprecated: "Future versions of base will not support the old exceptions style. Please switch to extensible exceptions."
[31 of 79] Compiling Plugin.BF ( Plugin/BF.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/BF.o )
[32 of 79] Compiling Plugin.Check ( Plugin/Check.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Check.o )
[33 of 79] Compiling Plugin.Compose ( Plugin/Compose.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Compose.o )
Plugin/Compose.hs:14:1:
Warning: Module `Control.OldException' is deprecated:
Future versions of base will not support the old exceptions style. Please switch to extensible exceptions.
Plugin/Compose.hs:14:30:
Warning: In the use of data constructor `NoMethodError'
(imported from Control.OldException):
Deprecated: "Future versions of base will not support the old exceptions style. Please switch to extensible exceptions."
[34 of 79] Compiling Plugin.Dice ( Plugin/Dice.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Dice.o )
[35 of 79] Compiling Plugin.Dict ( Plugin/Dict.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Dict.o )
[36 of 79] Compiling Plugin.Djinn ( Plugin/Djinn.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Djinn.o )
[37 of 79] Compiling Plugin.Dummy ( Plugin/Dummy.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Dummy.o )
[38 of 79] Compiling Plugin.Elite ( Plugin/Elite.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Elite.o )
[39 of 79] Compiling Plugin.Eval ( Plugin/Eval.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Eval.o )
Plugin/Eval.hs:19:1:
Warning: Module `Control.OldException' is deprecated:
Future versions of base will not support the old exceptions style. Please switch to extensible exceptions.
Plugin/Eval.hs:19:30:
Warning: In the use of `try'
(imported from Control.OldException):
Deprecated: "Future versions of base will not support the old exceptions style. Please switch to extensible exceptions."
[40 of 79] Compiling Plugin.Fact ( Plugin/Fact.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Fact.o )
[41 of 79] Compiling Plugin.Fresh ( Plugin/Fresh.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Fresh.o )
[42 of 79] Compiling Plugin.Haddock ( Plugin/Haddock.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Haddock.o )
[43 of 79] Compiling Plugin.Help ( Plugin/Help.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Help.o )
Plugin/Help.hs:6:1:
Warning: Module `Control.OldException' is deprecated:
Future versions of base will not support the old exceptions style. Please switch to extensible exceptions.
Plugin/Help.hs:6:30:
Warning: In the use of data constructor `NoMethodError'
(imported from Control.OldException):
Deprecated: "Future versions of base will not support the old exceptions style. Please switch to extensible exceptions."
[44 of 79] Compiling Plugin.Hoogle ( Plugin/Hoogle.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Hoogle.o )
[45 of 79] Compiling Plugin.Instances ( Plugin/Instances.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Instances.o )
[46 of 79] Compiling Plugin.Localtime ( Plugin/Localtime.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Localtime.o )
[47 of 79] Compiling Plugin.More ( Plugin/More.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/More.o )
[48 of 79] Compiling Plugin.OEIS ( Plugin/OEIS.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/OEIS.o )
[49 of 79] Compiling Plugin.Pl ( Plugin/Pl.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Pl.o )
Plugin/Pl.hs:24:51:
Warning: In the use of `isEmptyChan'
(imported from Control.Concurrent.Chan):
Deprecated: "if you need this operation, use Control.Concurrent.STM.TChan instead. See http://hackage.haskell.org/trac/ghc/ticket/4154 for details"
Plugin/Pl.hs:25:27:
Warning: In the use of `unblock'
(imported from Control.Exception, but defined in GHC.IO):
Deprecated: "use Control.Exception.mask instead"
[50 of 79] Compiling Plugin.Pointful ( Plugin/Pointful.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Pointful.o )
[51 of 79] Compiling Plugin.Poll ( Plugin/Poll.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Poll.o )
[52 of 79] Compiling Plugin.Pretty ( Plugin/Pretty.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Pretty.o )
[53 of 79] Compiling Plugin.Quote ( Plugin/Quote.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Quote.o )
[54 of 79] Compiling Plugin.Search ( Plugin/Search.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Search.o )
[55 of 79] Compiling Plugin.Slap ( Plugin/Slap.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Slap.o )
[56 of 79] Compiling Plugin.Source ( Plugin/Source.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Source.o )
[57 of 79] Compiling Plugin.Spell ( Plugin/Spell.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Spell.o )
[58 of 79] Compiling Plugin.State ( Plugin/State.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/State.o )
[59 of 79] Compiling Plugin.System ( Plugin/System.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/System.o )
[60 of 79] Compiling Plugin.Tell ( Plugin/Tell.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Tell.o )
[61 of 79] Compiling Plugin.Ticker ( Plugin/Ticker.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Ticker.o )
[62 of 79] Compiling Plugin.Todo ( Plugin/Todo.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Todo.o )
[63 of 79] Compiling Plugin.Topic ( Plugin/Topic.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Topic.o )
[64 of 79] Compiling Plugin.Type ( Plugin/Type.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Type.o )
[65 of 79] Compiling Plugin.Free ( Plugin/Free.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Free.o )
[66 of 79] Compiling Plugin.FT ( Plugin/FT.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/FT.o )
[67 of 79] Compiling Plugin.Undo ( Plugin/Undo.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Undo.o )
[68 of 79] Compiling Plugin.Unlambda ( Plugin/Unlambda.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Unlambda.o )
[69 of 79] Compiling Plugin.UnMtl ( Plugin/UnMtl.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/UnMtl.o )
[70 of 79] Compiling Plugin.Version ( Plugin/Version.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Version.o )
[71 of 79] Compiling Plugin.Vixen ( Plugin/Vixen.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Vixen.o )
[72 of 79] Compiling Plugin.Where ( Plugin/Where.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Where.o )
[73 of 79] Compiling NickEq ( NickEq.hs, dist/build/lambdabot/lambdabot-tmp/NickEq.o )
[74 of 79] Compiling Plugin.Karma ( Plugin/Karma.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/Karma.o )
[75 of 79] Compiling LMain ( LMain.hs, dist/build/lambdabot/lambdabot-tmp/LMain.o )
[76 of 79] Compiling Plugin.IRC ( Plugin/IRC.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/IRC.o )
Plugin/IRC.hs:8:1:
Warning: Module `Control.OldException' is deprecated:
Future versions of base will not support the old exceptions style. Please switch to extensible exceptions.
Plugin/IRC.hs:8:1:
Warning: In the use of `catchJust'
(imported from Control.OldException):
Deprecated: "Future versions of base will not support the old exceptions style. Please switch to extensible exceptions."
Plugin/IRC.hs:8:1:
Warning: In the use of `ioErrors'
(imported from Control.OldException):
Deprecated: "Future versions of base will not support the old exceptions style. Please switch to extensible exceptions."
[77 of 79] Compiling Plugin.OfflineRC ( Plugin/OfflineRC.hs, dist/build/lambdabot/lambdabot-tmp/Plugin/OfflineRC.o )
Plugin/OfflineRC.hs:17:1:
Warning: Module `Control.OldException' is deprecated:
Future versions of base will not support the old exceptions style. Please switch to extensible exceptions.
[78 of 79] Compiling Modules ( Modules.hs, dist/build/lambdabot/lambdabot-tmp/Modules.o )
cabal: Error: some packages failed to install:
lambdabot-4.2.3.3 failed during the building phase. The exception was:
ExitFailure 139
=== END ===
There's a hack in main/Main.hs to disable SIGPIPE handling. This should probably be handled in Lambdabot.Util.Signals, and should probably be converted to an exception rather than just ignored.
For example, "> " for @run, ":t" for @type, etc.
It would be nice to be able to allow commands to just state that they are triggered by some regex so they don't have to explicitly parse 'contextual' stuff (which isn't really even correct anyway, because contextual isn't called for privmsgs - maybe it should be?)
Related to #53
lambdabot> load whatever
Plugin `dummy' failed with: Prelude.read: no parse
Lambdabot should be a library, so that people wanting custom sets of plugins can easily create their own new "main" that pulls in what they want. It would also be a good idea to split the plugins into separate "core" and "contrib" libraries, like XMonad.
The current command-line parser is pretty ad-hoc and probably also is not in the right place.
The "real" main should do any arg parsing, converting command line args to config variable bindings.
I'm assuming that, like readline, haskeline offers tab completion. If this is the case, offlinerc should definitely use it at least for command names.
The COMMENTARY
file could use some updating. This should help bring more people into maintaining and developing lambdabot. I admit that at this stage I could use such commentary myself :)
Verify the contents of State directory and change its name to begin with a lowercase letter so it isn't confused with a directory containing Haskell modules. Personally I use a convention to name such a directory rc
to stand for .resources'. I don't know which contents of State/
is actually used. Also, it seems that some modules hardcode path to State/
instead of taking it from the configuration:
src/Lambdabot/File.hs
src/Lambdabot/Plugin/Instances.hs
src/Lambdabot/Plugin/Spell.hs
src/Lambdabot/Plugin/Vixen.hs
The timeout
function doesn't seem to always work on Mac OS (Linux seems fine). I'm not sure but I think it fails if it's invoked within the scope of another timeout. This is true with both the old timeout
in Lambdabot.Util
and the one provided with GHC in System.Timeout
. I'm guessing this is some quirk about exception masking but I'm not sure what specifically is going on.
(EDIT: i think the Mac OS association was a red herring; my development Mac has a lot more cores than the Linux system running my "live" instance, and I suspect that that is more relevant)
I'm not sure about this one but I think that Log
and Dynamic
modules are not used (Modules.hs
does not import them).
Gwern Branwen expressed concern on Haskell-cafe about security of this fork:
if as he says the security around the evaluation has been weakened, that's a deal-breaker until it's fixed. lambdabot can't be insecure since it will be run in a public IRC.
I installed mueval using:
$ cabal install mueval
It install version 0.8.2. I am able to evaluate expressions on the CLI:
$ mueval --expression '1 + 2'
3
When trying through lambdabot, I get this reply instead:
1 + 2
mueval: Using large values for -N is not allowed by default. Link with -rts...
I tried building mueval using the following but keep getting the above message:
$ cabal --ghc-option=-RTS --ghc-option=+RTS --ghc-option=-M512m install mueval --reinstall
What could I be missing?
Currently testsuite is a sad joke. It doesn't even compile and I doubt that the tests are even up to date. I'd say we get rid of the testsuite because it doesn't increase our confidence in the quality of the code (that's what tests are all about after all). If we ever decide to have a testsuite, which is probably a Good Thing, we should start from scratch and use testing libraries (HUnit, QuickCheck, Doctest, hspec).
If Lambdabot.Plugin.Haskell.Eval.Trusted
is moved to the exposed-modules
list of the lambdabot-haskell-plugins
package, "lambdabot"
is replaced by "lambdabot-haskell-plugins"
in the default trustedPkgs
, and Pristine.hs
/L.hs
are fixed to import Lambdabot.Plugin.Haskell.Eval.Trusted
, then it works. (Are the files in lambdabot/State
meant to be copied to ~/.lambdabot/State
as defaults on first run? I had to do it manually.)
Easiest way to achieve this would be to add the history as the OfflineRC module state.
Currently the Read
and Show
instances for Nick
(and, by extension, ChanName
) hard-codes a presentation rule (server tag is assumed to be "freenode"). This would be straightforward to change except for the fact that these instances are used to implicitly define the serialization for some modules' state.
I'd like to remove the special treatment of freenode without breaking old state files (the readNick and showNick functions already exist to read/show a nick giving special treatment to whatever server the current conversation target is from, so these should be used for all conversational purposes).
The session transcript from Issue #1 demonstrates something a user should never see; an error without any good hint about where or why it was thrown. We're at a bit of a disadvantage here because of how hard it is to reason about exceptions in Haskell but we should make an effort to at least report the plugin whose code threw the exception.
In the case of a "runGet" error, we should also be able to say what state file, if any, failed to be read.
IRC plugin currently relies on QSem
s, which will be removed in GHC 7.8. So all dependencies on QSem
should be replaced with SafeSemaphore
topic commands silently fail when the bot doesn't have ops. She should say "I can't do that" or the like.
Here's a transcript of a lambdabot session:
[killy@xerxes : ~/lambdabot-1] ./dist/build/lambdabot/lambdabot
Initialising plugins .................................................. done.
Main: caught (and ignoring) Data.Binary.Get.runGet at position 0: demandInput: not enough bytes
lambdabot> > 1 + 1
Main: caught (and ignoring) Data.Binary.Get.runGet at position 0: demandInput: not enough bytes
mueval-core: UnknownError "GHC returned a result but said: [GhcError {errMsg = \"L.hs:9:14:\\n
-XDoRec is deprecated: use -XRecursiveDo or pragma {-# LANGUAGE RecursiveDo #-} instead\"}]"
lambdabot> Elambdabot: <stdin>: hGetLine: end of file
xception: all servers detached
exception:
Data.Binary.Get.runGet at position 0: demandInput: not enough bytes
Compiled on GHC 7.6.2
I have successfully been able to build lambdabot 4.3 on Fedora 18 (x86_64). When I try to run it, I get:
$ lambdabot
Initialising plugins ....exception:
/home/guest/.cabal/share/lambdabot-4.3/State/system: copyFile: does not exist (No such file or directory)
$ ls ~/.cabal/share/lambdabot-4.3/State/
djinn haddock L.hs Pristine.hs seen tell url where
fresh karma poll quote source todo vixen
I created online.rc in ~/.cabal/share/lambdabot-4.3/:
=== online.rc ===
irc-connect freenode chat.freenode.net 6667 lambuf
join freenode:#fedora-haskell
=== END ===
$ lambdabot -e 'rc ~/.cabal/share/lambdabot-4.3/online.rc'
Initialising plugins ....exception:
/home/guest/.cabal/share/lambdabot-4.3/State/system: copyFile: does not exist (No such file or directory)
$ lambdabot -e 'rc online.rc'
Initialising plugins ....exception:
/home/guest/.cabal/share/lambdabot-4.3/State/system: copyFile: does not exist (No such file or directory)
It would be nice if the "rc" command, which is often used on the command-line, understood "~", "~user", etc., in paths. "$HOME" works fine on the command-line, but I could see wanting to use it in the offlinerc mode as well.
I think my ideal solution would be to use the shell expansion stuff from language-sh, so it could support globs, environment variables, etc. as well. It might even be nice to make the offlinerc interface offer shell expansions for all input (probably off by default though).
Lambdabot relies on libraries that are no longer maintained:
old-time
regex-compat
regex-posix
I guess the code would be easier to maintain if we switched to something more actively developed. We should definitely use time
instead of old-time
.
It is possible for the state (remembered quotes) of the quote module to contain a user with no quotes, which causes an exception when quoting that user.
Dummy
plugin refers to fptools
. I'm not exactly sure what fptools
was anyway, but I think it doesn't exist any more.
If they are not something most users want, they should be configured to be inactive by default, rather than simply not installed.
Pl
plugin uses a deprecated function isEmptyChan
, which results in a warning during compilation. The interesting fragment of code looks like this:
optimizeIO :: Int -> Expr -> IO (Expr, Bool)
optimizeIO to e = do
chan <- newChan
result <- timeout to (writeList2Chan chan $ optimize e)
e' <- getChanLast chan e
return $ case result of
Nothing -> (e', False)
Just _ -> (e', True)
getChanLast :: Chan a -> a -> IO a
getChanLast c x = do
b <- isEmptyChan c
if b then return x else getChanLast c =<< readChan c
Warning says to use TChan
instead of Chan
, but I think that using STM here is an overkill. Besides, the above piece of code looks a bit like a hack. Perhaps there is a more elegant way of performing computations that time out? If no then I guess we'll just ignore deprecation warning.
On my system I need to press up or down arrow twice to move to previous/next element of the input history. This is caused by manually adding command to history.
I get
fd:9: hClose: resource vanished (Broken pipe)
when I try to load the djinn plugin on OSX with 7.6.3
Load fine if I commit it out in the module file.
Thanks for the logging :)
When lambdabot is compiled using GHC 7.6 evaluation of Haskell expressions always fails due to deprecation of DoRec
pragma used in State/L.hs
:
lambdabot> > map id [1,2,3]
mueval-core: UnknownError "GHC returned a result but said: [GhcError {errMsg = \"L.hs:9:14:\\n -XDoRec is deprecated: use -XRecursiveDo or pragma {-# LANGUAGE RecursiveDo #-} instead\"}]"
However, looking at this I believe that changing DoRec
to RecursiveDo
will break lambdabot under GHC 7.4.
Currently modules occupy top-level namespace, which is not a Good Thing. I suggest we move everything (including plugins) to Lambdabot.* namespace.
When splitting the packages up, I removed some special case handling from the Base plugin that translated occurrences of the evalPrefix into invocations of the "run" command.
That was a pretty big hack and definitely didn't belong there, but the functionality is important and needs to be reimplemented by the eval plugin before the next release.
Need to see whether the latest version(s) of mueval work with the current eval module and add a cabal dependency for the version required. If it doesn't, I need to track down the changes I made locally and submit them to mueval's maintainer.
Current build settings suppress some of the warnings:
-fno-warn-incomplete-patterns
-fno-warn-missing-methods
-fno-warn-orphans
It would be nice to get rid of those (if possible) and add -Wall
flag to build settings. Seems a bit suicidal though. I don't think we can do something reasonable about orphan instances.
One issue we must settle before moving on with this is how should handle problems with code like this:
main :: IO ()
main = do
installHandler sigPIPE Ignore Nothing
main' Nothing modulesInfo
which causes the warning:
src/Main.hs:18:5: Warning:
A do-notation statement discarded a result of type Handler.
Suppress this warning by saying "_ <- installHandler
sigPIPE
System.Posix.Signals.Ignore
(Data.Maybe.Nothing)",
or by using the flag -fno-warn-unused-do-bind
My vote is to use _ <-
. It seems like a boilerplate but it explicitly shows that we are discarding something and I believe that in the long run this will make code easier to read and understand.
I am trying to build lambdabot (master) from source using cabal install, and I hit this error:
=== Error ===
Resolving dependencies...
Configuring random-source-0.3.0.4...
Building random-source-0.3.0.4...
Preprocessing library random-source-0.3.0.4...
[ 1 of 11] Compiling Data.Random.Internal.Prim ( src/Data/Random/Internal/Prim.hs, dist/build/Data/Random/Internal/Prim.o )
[ 2 of 11] Compiling Data.Random.Internal.Source ( src/Data/Random/Internal/Source.hs, dist/build/Data/Random/Internal/Source.o )
[ 3 of 11] Compiling Data.Random.Source.Std ( src/Data/Random/Source/Std.hs, dist/build/Data/Random/Source/Std.o )
[ 4 of 11] Compiling Data.Random.Source.StdGen ( src/Data/Random/Source/StdGen.hs, dist/build/Data/Random/Source/StdGen.o )
[ 5 of 11] Compiling Data.Random.Internal.Words ( src/Data/Random/Internal/Words.hs, dist/build/Data/Random/Internal/Words.o )
[ 6 of 11] Compiling Data.Random.Internal.TH ( src/Data/Random/Internal/TH.hs, dist/build/Data/Random/Internal/TH.o )
[ 7 of 11] Compiling Data.Random.Source.PureMT ( src/Data/Random/Source/PureMT.hs, dist/build/Data/Random/Source/PureMT.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package mtl-2.1.2 ... linking ... done.
Loading package array-0.4.0.0 ... linking ... done.
Loading package stm-2.4.2 ... linking ... done.
Loading package stateref-0.3 ... linking ... done.
Loading package primitive-0.5.0.1 ... linking ... done.
Loading package deepseq-1.3.0.1 ... linking ... done.
Loading package old-locale-1.0.0.4 ... linking ... done.
Loading package time-1.4.0.2 ... linking ... done.
Loading package vector-0.10.0.1 ... linking ... done.
Loading package mwc-random-0.12.0.1 ... linking ... done.
Loading package old-time-1.1.0.0 ... linking ... done.
Loading package random-1.0.1.1 ... linking ... done.
Loading package mersenne-random-pure64-0.2.0.3 ... linking ... done.
Loading package containers-0.5.2.1 ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package syb-0.3.7 ... linking ... done.
Loading package th-extras-0.0.0.2 ... linking ... done.
Loading package flexible-defaults-0.0.1.1 ... linking ... done.
src/Data/Random/Source/PureMT.hs:63:3:cabal: Error: some packages failed to install:
dice-0.1 depends on random-source-0.3.0.4 which failed to install.
lambdabot-4.3 depends on random-source-0.3.0.4 which failed to install.
misfortune-0.1.1.1 depends on random-source-0.3.0.4 which failed to install.
random-fu-0.2.4.0 depends on random-source-0.3.0.4 which failed to install.
random-source-0.3.0.4 failed during the building phase. The exception was:
ExitFailure 139
rvar-0.2.0.1 depends on random-source-0.3.0.4 which failed to install.
=== END ===
Lambdabot has a huge amount of utility code, a lot of it replicating stuff available on hackage. Personally, I'd rather outsource it than maintain a bunch of different half-baked libraries.
I'd like to weed through the many utility modules, thin them out, and probably rearrange what's left. If there is any truly unique functionality that might be useful elsewhere, I'd also like to extract that to a package(s).
From the command line, the user should be able to:
This may involve setting up dynamic plugin loading.
A couple of places in the code contain code intended for Windows. This should be cleaned up so that lambdabot relies on portable Haskell libraries running both on *nix and Windows. The relevant files are:
src/Lambdabot/Serial.hs
src/Lambdabot/Monad.hs
src/Lambdabot/Signals.hs
src/Lambdabot.hs
Lambdabot.Plugin.Haskell.Eval.Trusted
re-exports Lambdabot.Plugin.Haskell.Check.ShowQ
, which exports myquickcheck
, a non-deterministic (and hence impure) function, since QuickCheck relies on random generation of input parameters. This seems undesirable; QuickCheck is already available through the @check
command, anyway. Perhaps the import/re-export should simply be removed?
It also re-exports Math.OEIS
, which is even more blatantly impure (it does network connections!), though the @oeis
interface is considerably more restricted, so there's not as clear a case for removal... still, I think @run
should be as pure as possible.
(Also, the Show
instance for Mu
is missing; is this because it requires UndecidableInstances
?)
Would be nice to detect when hoogle hasn't been initialized, and fire off a background task to do so (or at least tell the user what they need to do to make the hoogle command work).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.