Code Monkey home page Code Monkey logo

lambdabot-telegram-plugins's Introduction

lambdabot-telegram-plugins

Description

Installation

  • It is assumed that you are using cabal-install >= 3.4.
  • telegram-lambdabot was tested with cabal-install 3.6.2.0 and GHC 8.10.7.
  1. Install djinn to enable /djinn command.
cd /path/to/projects/dir
git clone https://github.com/augustss/djinn.git
cd djinn
perl -pi -e 's/import LJTFormula/import LJTFormula\nimport Prelude hiding \(\(<>\)\)/g' src/HTypes.hs
cabal install --overwrite-policy=always
  1. Install mueval to enable commands from eval plugin. The "core" Haskell plugin with set of a few REPL commands.
cd /path/to/projects/dir
git clone https://github.com/gwern/mueval.git
cd mueval
echo 'packages .\n\nwrite-ghc-environment-files: always\n' > cabal.project
cabal build
cabal install --overwrite-policy=always
  1. Install hoogle to enable /hoogle command.
cd /path/to/projects/dir
git clone https://github.com/ndmitchell/hoogle.git
cd hoogle
cabal install --overwrite-policy=always
hoogle generate

It might take a while.

  1. Clone this repo. Set up mueval env.
cd /path/to/projects/dir
git clone https://github.com/swamp-agr/lambdabot-telegram-plugins.git
cd lambdabot-telegram-plugins
cabal install --overwrite-policy=always
cp /path/to/projects/dir/mueval/.ghc* /path/to/projects/dir/lambdabot-telegram-plugins
perl -pi -e 's/.*mueval.*//g' .ghc*
cabal build

Add following line into .ghc* env file:

package-db dist-newstyle/packagedb/ghc-X.Y.Z

where X.Y.Z is the GHC version.

  1. Set up TELEGRAM_LAMBDABOT_TOKEN env variable. Don't forget to export it.

  2. Run telegram-lambdabot from the lambdabot-telegram-plugins dir (where mueval env was prepared earlier).

Usage

Set bot name via @BotFather and run:

telegram-lambdabot -n <botname>

Following commands are available:

  • /irc - Send command to Lambdabot.
  • /run - run . You have Haskell, 3 seconds and no IO. Go nuts!
  • /let - let = . Add a binding.
  • /define - let = . Add a binding.
  • /undefine - undefine. Reset evaluator local bindings.
  • /check - check . You have QuickCheck and 3 seconds. Prove something.
  • /djinn - djinn . Generates Haskell code from a type.
  • /djinnadd - djinn-add . Define a new function type or type synonym.
  • /djinndel - djinn-del . Remove a symbol from the environment.
  • /djinnenv - Show the current djinn environment.
  • /djinnnames - Show the current djinn environment, compactly.
  • /djinnclr - Reset the djinn environment.
  • /djinnver - Show current djinn version.
  • /free - free . Generate theorems for free.
  • /index - index . Returns the Haskell modules in which is defined.
  • /hoogle - hoogle . Haskell API Search for either names, or types.
  • /instances - instances . Fetch the instances of a typeclass.
  • /instancesimporting - instancesimporting [ [ [<module...]]] . Fetch the instances of a typeclass, importing specified modules first.
  • /pl - pointless . Play with pointfree code.
  • /pointy - pointful . Make code pointier.
  • /repoint - pointful . Make code pointier.
  • /unpointless - pointful . Make code pointier.
  • /unpl - pointful . Make code pointier.
  • /unpf - pointful . Make code pointier.
  • /pretty - pretty . Display haskell code in a pretty-printed manner
  • /listmodules - listmodules. Show available plugins.
  • /list - list [module|command]. Show commands for [module] or the module providing [command].
  • /echo - echo . echo irc protocol string.
  • /uptime - uptime. Show uptime.
  • /type - type . Return the type of a value.
  • /kind - kind . Return the kind of a type.
  • /undo - undo . Translate do notation to Monad operators.
  • /do - do . Translate Monad operators to do notation.
  • /unmtl - unroll mtl monads.
  • /version - version/source. Report the version and git repo of this bot
  • /help - help . Ask for help for . Try 'list' for all commands.
  • /src - src . Display the implementation of a standard function.

Available instance(s)

Acknowledgements

  • James Cook
  • Chris Done
  • Lambdabot maintainers
  • Telegram Haskell Community

lambdabot-telegram-plugins's People

Contributors

swamp-agr avatar

Stargazers

Kuchma Andrey avatar  avatar  avatar Mohammad Hasani avatar ˌbodʲɪˈɡrʲim avatar  avatar Hoang Phan avatar Andrei Borzenkov avatar Alexander Vershilov avatar kana avatar Evgeny Gazdovsky avatar

Watchers

James Cloos avatar  avatar

lambdabot-telegram-plugins's Issues

Use / instead of @ for telegram

Native plugins come with its own preconfigured help messages and other messages too. Telegram commands start with / instead of @.

/list

Expected result:

What module?  Try /listmodules for some ideas.

Actual result:

What module?  Try @listmodules for some ideas.

Decide on `/echo` command

Right now /echo exposes IrcCommand details while it should only respond with echo of user data.

Choice:

  • Disable command
  • Fix command output.

Quotes and apostrophes mismatch

Input command:

/unmtl ErrorT ByteString (WriterT String (State s)) a

Expected result:

err: `ErrorT ByteString ( WriterT String State )` is not applied to enough arguments, giving `/\A B. Either ByteString A -> String -> (B, Either ByteString A, String)`

Actual result:

err: `ErrorT ByteString ( WriterT String State )' is not applied to enough arguments, giving `/\A B. Either ByteString A -> String -> (B, Either ByteString A, String)'

The best solution is to make configurable quotes in upstream lambdabot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.