File: README.md

package info (click to toggle)
lambdabot 5.3.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 336 kB
  • sloc: haskell: 93; sh: 36; makefile: 7
file content (84 lines) | stat: -rw-r--r-- 2,925 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# About Lambdabot

Lambdabot is an IRC bot written over several years by those on the Libera's
(formerly freenode's) `#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.

## Installation

The easiest way to install `lambdabot` is from hackage, by the following
commands,

    cabal v1-install lambdabot
    hoogle data

or, using v2 commands:

    cabal v2-install lambdabot hoogle misfortune mueval unlambda dice
    hoogle data
    cabal v2-install --lib lambdabot-trusted random mtl show

The second command fetches the data for Lambdabot's `@hoogle` command, which
is a thin wrapper around the [`hoogle`](https://www.haskell.org/hoogle/)
command line tool. Invoking `lambdabot` will (hopefully) display a
`lambdabot>` prompt.

It is also possible to install lambdabot in a sandbox. In that case, use
`cabal exec lambdabot` to launch lambdabot.

## Files

Some lambdabot modules maintain state. The state is stored in `./State/`
if that directory exits; otherwise, it will end up on `~/.lambdabot/State/`.
State files of particular interest are:

 * `Pristine.hs` and `L.hs`: Environment for running Haskell code.
   The command `@let` adds new definitions to `L.hs`, whereas `@undefine`
   copies `Pristine.hs` to `L.hs`.
 * `offlinerc`: This file contains a history of commands typed into
   lambdabot's tty interface.

## Customization

The state file `Pristine.hs` defines the environment in which Haskell code
is run. To customize lambdabot's modules, unpack the lambdabot package

    cabal unpack lambdabot; cd lambdabot-<version>

You can then edit `src/Modules.hs` to configure the loaded modules.

## Using Lambdabot

Lambdabot has a number of modules, most of which provide several commands.
Type `@listmodules` to obtain a list of module names, and then
`@list <module>` to list a module's commands. Executing `@help command`
displays a short description of the command.

The following sample session demonstrates some useful lambdabot commands.

    lambdabot> > sum [1..10]
     55
    lambdabot> @let foo = 42
    lambdabot> > product [1..foo]
     1405006117752879898543142606244511569936384000000000
    lambdabot> @undefine
        Not in scope:‘foo’
        Perhaps you meant ‘Data.Traversable.for’ (imported from Data.Traversable)
    lambdabot> @type map
    (a -> b) -> [a] -> [b]
    lambdabot> @djinn (b -> c) -> (a -> b) -> a -> c
    f a b c = a (b c)
    lambdabot> @pl \x y z -> y z x
    flip flip
    lambdabot> @unpl flip flip
    (\ b c f -> c f b)
    lambdabot> @undo do x <- step1; step2; step3
    step1 >>= \ x -> step2 >> step3

## Further Information

- [lambdabot](https://github.com/lambdabot/lambdabot) on github
- [lambdabot](https://wiki.haskell.org/Lambdabot) on the Haskell wiki (outdated)
- [GOA: GHCI integration](https://wiki.haskell.org/GHC/GHCi#GHCi_on_Acid) (Haskell Wiki)