• This repository has been archived on 02/Jan/2020
  • Stars
    star
    130
  • Rank 277,575 (Top 6 %)
  • Language
    Haskell
  • License
    Other
  • Created almost 7 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Compile Idris to Vimscript, like you always wanted.

Idris Vimscript!

The good stuff.

Please note that this is very experimental. For example, the Idris Integer type, usually represented as an arbitrary-precision integer, is represented using the Vim number type.

It's a hack, deal with it. ๐Ÿ˜Ž

Or, better still:

Contribute!

This is a fun project, and the authors aren't expert compiler writers: we need your help! There are three languages (Idris, Haskell, and documentation!) you can contribute in, and knowledge of Vimscript is useful too. Specifically:

  • if you know a little Idris, you can add bindings for more of the Vim API
  • if you know some Haskell, you can add new or improve existing optimisations, make the generated code better, or improve performance
  • if you can do Vimscript, we'd like you to help us generate better, faster, smaller code that Vimscript users can understand somewhat well
  • The Idris REPL itself lets people browse documentation, so even a few comments on key functions can make users' day-to-day lives much easier when they're discovering the API.

Good first issues for new contributors are tagged on our issue tracker.

If you have an idea in mind, open a PR!

Finally, if you write a Vim plugin using Idris Vimscript, let us know!

Examples

Many examples of what is possible are present in the examples/ directory, but this will give you an idea of the state of the art:

module Main

import Vimscript.FFI
import Vimscript.List
import Vimscript.Builtin

main : VIM_IO ()
main = do
  l <- line "$"              -- get the last line number
  s <- getline (l - 1)       -- get the contents of the next-to-last line
  let sl = length s          -- get its length
  echo (substr 3 (3 + sl) s) -- print a part of it

Build and Install

Install the code generator:

stack install # or cabal install

Install the Vimscript library for Idris:

idris --install vimscript.ipkg

Build and Run Examples

The project comes accompanied by a convenience make script that will compile all the Idris files in examples folder.

make
vim examples/loop.vim
# :source %             (in Vim)

In order to build a single example, you can compile it as below (this is what make is doing).

idris examples/myfile.idr -i lib/ --codegen vim -o examples/myfile.vim

License

BSD 3 License. Based on original work by Edwin Brady.

More Repositories

1

the-monospace-web

A minimalist design exploration
HTML
1,258
star
2

komposition

The video editor built for screencasters
Haskell
429
star
3

gi-gtk-declarative

Declarative GTK+ programming in Haskell
Haskell
288
star
4

vim-colors-paramount

A minimal colorscheme for Vim that only puts emphasis on the paramount.
Vim Script
243
star
5

pandoc-include-code

A Pandoc filter for including code from source files
Haskell
140
star
6

motor

Type-safe effectful state machines in Haskell
Haskell
94
star
7

tlaplus-cli-template

CLI-driven TLA+ project template
Makefile
43
star
8

pandoc-emphasize-code

A Pandoc filter for emphasizing code in fenced blocks
Haskell
28
star
9

minimal-kotlin-nix-example

Minimal Kotlin and Nix flake example (with Gradle 8 support)
Nix
26
star
10

automating-the-build-of-your-technical-presentation-template

The full template for "Automating the Build of your Technical Presentation"
TeX
26
star
11

wickstrom.tech

Source for my blog
HTML
24
star
12

fast-and-fearless-evolution-of-server-side-webapps

Slides and code examples for a talk
Haskell
22
star
13

purescript-leffe

The Labeled Effects Extension to PureScript
PureScript
21
star
14

twitter-kinesis-lab

A lab on how to use Amazon Kinesis for finding popular hashtags.
Clojure
20
star
15

dotfiles

My dotfiles for OSX and Ubuntu
Vim Script
19
star
16

minimal-beamer-slides-template

A minimal template for LaTeX Beamer slideshows
TeX
19
star
17

smug

The Sheet Music Generator
Clojure
14
star
18

domain-modeling-with-haskell-data-structures

A talk given at the Polyglot meetup in CPH, March 2018
Haskell
13
star
19

home-manager

Nix home-manager setup
Nix
8
star
20

fsm-your-compiler-wants-in

The slide sources for "Finite-state machines? Your compiler wants in!"
Haskell
7
star
21

hedgehog-inline-java-testing

haskell-hedgehog's model-based state machine testing together with inline-java
Haskell
6
star
22

sqsd-local

A local version of sqsd, the daemon in Elastic Beanstalk's Worker Environments.
Haskell
6
star
23

declarative-gtk-programming-in-haskell

A talk given at LambdAle
JavaScript
5
star
24

writing-a-screencast-video-editor-in-haskell

A talk for Lambda World Cadiz 2018
JavaScript
4
star
25

gameoflife

Conway's Game Of Life, written in ClojureScript.
Clojure
3
star
26

websub

A WebSub client for Haskell
Haskell
3
star
27

.emacs.d

Emacs Lisp
3
star
28

domain-modeling-with-haskell-data-structures-oredev

JavaScript
2
star
29

property-based-testing-the-ugly-parts

A talk for MF#K, February 26, 2019
JavaScript
2
star
30

fuzzig

Melding fuzzing and PBT concepts in Zig (experiment)
Zig
2
star
31

domain-modelling-with-haskell-workshop

HTML
2
star
32

power-of-fp-static-types-server-side-web

Slides of my talk: The Power of Functional Programming and Static Type Systems in Server-Side Web Applications
TeX
2
star
33

owickstrom

The profile page
1
star
34

clojurescript-koans

Clojure Koans for ClojureScript
Clojure
1
star
35

zap

A LISP interpreter in Javascript
JavaScript
1
star
36

haskell-robot-lab

An introductory Haskell lab.
Haskell
1
star
37

specifying-and-testing-web-applications

Slides for a talk
TeX
1
star
38

hello-node-cljs

Testing Node and Express with ClojureScript.
Clojure
1
star
39

gitpod-nix-test

Dockerfile
1
star
40

service-worker-lab

Add offline capabilities to a web app using Service Worker.
JavaScript
1
star
41

guism-example

WIP
Haskell
1
star
42

blog-post-dataflow

Makefile
1
star
43

psc-vimscript

PureScript
1
star