HaskellWiki

Haskell | Wiki community | Recent changes
Random page | Special pages

 

Not logged in
Log in | Help

Yi

Categories: Applications

Image:Yi-logo.png

Contents

1 About

Yi is a text editor written and extensible in Haskell. The goal of Yi is to provide a flexible, powerful and correct editor core scriptable in Haskell.

Features:

The long term goal of the project is to make Yi the editor of choice for the haskell hacker.

The main short term goal is to maximize Yi's Fun Factor. This includes:

former Yi homepage: http://www.cse.unsw.edu.au/~dons/yi.html

2 Get Yi

Stable release on Hackage:

(NOTE: the 0.2 release does not work with recent versions of GHC/libraries, and is not supported at all. Please use the darcs repo version instead.)

Development repository:

darcs get --partial http://code.haskell.org/yi/

We try to keep the repository in a clean and buildable state, so it's "testable". If you have Darcs installed and a GHC 6.8.x installation, this is a better choice.

2.1 Yi for Mac OS X

The easiest way to get Yi for Mac OS X is to use MacPorts. To do this, go to Terminal.app and type:

sudo port install ghc yi

and you should be able to use Yi. Additionally, if you want a nice .app front-end you can download Yi.app (which does not contain Yi, it is just a wrapper, for now) and edit Yi.app/Contents/Resources/script if you did not use MacPorts to install Yi.

3 Screenshots (0.3)

The GTK frontend
Enlarge
The GTK frontend
The Vty frontend
Enlarge
The Vty frontend

4 NEWS

(Recent items first)

/OldNews

5 Bugs

Check/report bug reports here: Google Code: yi-editor

6 FAQs

6.1 Installation

get it from Hackage. Configure, compile and install Yi as you would do for any other Cabal package.
You need to use Cabal version 1.2.3. To make sure you use it, do:
   ghc -package Cabal-1.2.3.0 --make Setup.hs
   ./Setup configure ...
Setup.hs: Package yi-0.3 can't be built on this system.
It means that you have no UI package available. You need VTY or GTK2hs installed. Get them from Hackage.
yi: can't load .so/.DLL for: gthread-2.0 (dlopen(libgthread-2.0.dylib, 10): image not found)
then your dynamic library search path variable is probably not set correctly. You can set it (in Bash) using:
export DYLD_LIBRARY_PATH=/opt/local/lib
(Adjust the specific path to your system. You can find the right location using locate libgthread)
Yi/UI/Vty.hs:342:48:
Couldn't match expected type
`bytestring-0.9.0.4:Data.ByteString.Internal.ByteString'
against inferred type `B.ByteString'
In the second argument of `renderBS', namely `(B.pack str)'
In the expression: renderBS (styleToAttr sty) (B.pack str)
In the definition of `withStyle':
withStyle sty str = renderBS (styleToAttr sty) (B.pack str)
This is because versions of ByteString often aren't compatible, and in this case, the VTY library was compiled with a different version.
No instance for (RegexLike Regex B.ByteString)
The proper fix requires some more cabal features which hopefully come with Cabal 1.4. So long we have a workaround as described in this message.

For a more extensive explanation, see http://blog.well-typed.com/2008/04/the-dreaded-diamond-dependency-problem/

6.1.1 Development

Get it from http://code.haskell.org/yi while there are other repositories of Yi out there, this is the latest.
The development version of Yi currently requires Cabal-1.5.2, Crypto-4.1.0, fingertree-0.0, and utf8-string-0.3.1.
If you are on Mac OS X and are using MacPorts, then these will not be included in the GHC in that distribution. Many of the dependancies are in MacPorts (for example: ghc, ghc-devel, alex, and gtk2hs). However, you may have some trouble building with Cabal-1.5.2, since it is a development version of Cabal. To work around these issues, you might have to add the line "Build-Type: Simple" to the .cabal files in the above required packages.

6.2 Configuration

6.2.1 How to Configure Yi

You can find configuration file examples in the 'examples/' directory, or online at http://code.haskell.org/yi/examples/.

A good way to start is to copy yi.hs in your ~/.yi directory (create it if needed), and hack as needed.

6.3 Usage

7 Contribute

Get the repo here:

darcs get --partial http://code.haskell.org/yi/

Work on whatever you please, patches are always welcome. :)

Otherwise, see the complete list of open issues here: http://code.google.com/p/yi-editor/issues/list

(Note you can start working on all issues in New/Accepted state, regardless of the owner of the issue. -- you can send an email to the list with your plan if unsure)

Post your questions and follow up on the mailing list: http://groups.google.com/group/yi-devel

Some other pending tasks are described below.

7.1 Write access policy

One does not need write access to the repository to contribute. Use "darcs send" to send your patches to the Yi development mailing list; someone else can apply them.

Write access can however be granted, with the following disclaimer:

8 Yi ideas

This section is meant to gather ideas people have for Yi.

Show exact location of compilation errors: 80% of an haskell project
Support for the ghci debugger & others: 10 % of an haskell project (Added bonus: greath for learning: trough the debugger, people learn the real execution flow of an haskell program. Better if this is done inside an editor)
Integration of refactoring tools : 5 %
Edition: only 5%


This seems to be (reasonably) straightforward, as GHCi already has :info. It would mean hacking the type environment (what about values?) to add documentation information. The main problem would seem to be populating this --- maybe hack haddock to produce something from the library docs? I assume that using package GHC uses the parent RTS (package GHC seems to be the way to go, but more investigation is required --- don?)
Rather than just editing a file, you would open a view onto the file, i.e. there is no longer a 1-1 correspondence between buffers and files. Why? Well, for aggregate buffers (i.e., editing multiple files in the one view), or for multiple views of a file (e.g. AST and source-level). There would be some primitive ops for editing a buffer (insertChar, delete, etc.), which would then call update functions on anything observing that file.
Like Emacs's server?
(no brainer), maybe associate with .hi files for binaries.

8.1 Borrowing from other editors

Take some ideas from emacs, some from vi, but don't stick them all together without a single core philosophy. Otherwise, you'll end up with an editor that looks like it was thrown together. Some people come from an emacs background, some from vi, some from elsewhere, and ALL of them will want yi to behave like their regular editor. The best way to do this is to have a single person make all the decisions on behaviour.

8.1.1 Emacs

Coming from an Emacs background, I think a few things are essential, mainly the introspection capabilities of Emacs.

8.1.1.1 Emacs goodness

The following are things I like about Emacs, as an extensible environment, and miss in Yi:

Really good online documentation
Emacs can tell you a lot about a function or variable with a keypress--- the current value, where it is declared, and a hypertext formation string
Hooks-Extensibility
All (good) apps allow users to extend, through, e.g., hooks --- a list of functions that are run before/after some event (like saving a file)


8.1.1.2 Emacs badness

So, why replace it?:

ELisp
Dynamically scoped, Dynamically typed, ugly, old. 'Nuff said
What's a Parser?
A lot of apps in emacs do stuff with text, usually text that is in some language. There is no standard parser (like, e.g. parsec), so a lot of it is ugly handwritten spaghetti. This also means that adding analysis tools isn't really done (or done nicely).
ELisp again
Haskell is a lot cleaner to write, especially because of the large number of libraries.

(See also WhyDoesElispSuck on the Emacs wiki.)

8.1.1.3 Emacs maybeness (?)

Some things that are sometimes bad, sometimes good:

Everything is a buffer
Makes some sense, but sometimes doesn't. It is nice to have uniform key bindings do the right thing (e.g., C-Space sets the mark, and the region can then be used, e.g. to delete a sequence of emails in Wl) Sometimes, however, you just want some sort of GUI widget.
OTOH, having the minibuffer be a special kind of buffer is a good idea.
Properties
It is possible to associate arbitrary properties with symbols. This means you can annotate a symbol and then use that information at a later date

8.1.2 Vi?

good things
modal key editing -> configuration system is powerful enough!
light weight - fast startup -> yi has this :)


8.2 Ideas

8.3 Implementation

Considerations:

Interface to the runtime
The scheduler, docs, etc.
Introspection of e.g. what processes are running.
There are already libraries in Haskell for processes, but they don't give Yi any extra information --- we really want a layer on top.

...

9 Trivia

Y I is the most recursive acronym. (Read it as combinators). 義, pronounced yi, means righteousness, one of the five virtues of confucianism.

Retrieved from "http://haskell.org/haskellwiki/Yi"

This page has been accessed 21,293 times. This page was last modified 05:25, 23 June 2008. Recent content is available under a simple permissive license.