
Rasa: Extremely modular text editor built in Haskell - poiuz
https://github.com/ChrisPenner/rasa
======
ChrisPenner
Author here; I can answer any questions you might have; It's still a really
early project but it's growing quickly! Anyone who's interested should join in
the discussion in our chat-room here: [https://gitter.im/rasa-
editor/Lobby](https://gitter.im/rasa-editor/Lobby)

------
harpocrates
This looks really neat. I really like the idea, and I think it has lots of
potential.

That said, I'm going to try to moderate my enthusiasm until more stuff gets
implemented. Thinking back to Yi [0], there is a lot of really cool stuff in
that too (namely precise syntax highlighting, which relied heavily on parsing
lazily). There's even a couple papers written about it [1]! IIRC, the main
problem was (I think it has been at least partially dealt with) performance -
people expect their editors to be blazingly fast. It will be interesting to
see if Rasa encounters similar problems.

[0] [http://yi-editor.github.io/](http://yi-editor.github.io/) [1]
[https://github.com/yi-editor/yi#reading-material](https://github.com/yi-
editor/yi#reading-material)

~~~
ChrisPenner
Right now it's pretty experimental; We'll be keeping an eye on performance of
course, but at the moment a good API is more important. Time will tell!

------
HugoDaniel
Love it, specially the "What people are saying" part :D

    
    
      * Excessively Modular! - some bald guy
      * I'm glad I'm unemployed so I have time to configure it! - my mate Steve
      * You should go outside one of these days. - Mother

~~~
progman
> I'm glad I'm unemployed so I have time to configure it!

That raises the question if the author is also unemployed so that he had the
time to write it ;-) It would be interesting to know how much time he actually
needed.

------
wyc
> I'm glad I'm unemployed so I have time to configure it! - my mate Steve

> You should go outside one of these days. - Mother

These quotes are great.

------
peatmoss
Without knowing too much about either editor, how does this compare / differ
with Yi ([http://yi-editor.github.io/](http://yi-editor.github.io/))?

~~~
SirensOfTitan
I think I remember the author posting on /r/haskell a bit back about this
project. He mentioned that in his editor even the core editor functionality
are implemented as extensions (contrary to Yi), so the extension API is quite
robust.

~~~
taylorfausak
> Rasa is putting extensions first from the very beginning, I've read that Yi
> has plans to extract their renderers into extensions but hasn't been able to
> easily extract them at this point. In rasa, EVERYTHING is an extension (for
> better or worse I suppose we'll see).

[https://www.reddit.com/r/haskell/comments/5l0a2i/rasa_modula...](https://www.reddit.com/r/haskell/comments/5l0a2i/rasa_modular_texteditor/dbsbdog/?context=1)

------
thinkpad20
I'm excited to see another option appear in text editing, and excited that
it's written in Haskell, one of my favorite languages. But, why would I choose
it over another text editor? The ability to customize it is neat, but editors
like emacs can be customized to one's heart's content, and indeed can suffer
from this (why did my editor suddenly become slow? why is my syntax
highlighting or indentation not working correctly? who knows, it's the
interaction of one of the 50 packages I have installed...).

Of course, you as the author are under no obligation save to write whatever
you want, but speaking personally, I would love to see some sort of
demonstration of how the editor works, and/or the case made selling me on why
I should choose it over other options.

~~~
rcthompson
I will say this for Emacs, though: while bad interactions between packages do
happen, they're surprisingly rare given the number and variety of packages
that are available.

~~~
mpweiher
That seems to be generally the case for the horrors of dynamic typing: rampant
in the imagination, _surprisingly rare_ in the real world.

[http://blog.metaobject.com/2014/06/the-safyness-of-static-
ty...](http://blog.metaobject.com/2014/06/the-safyness-of-static-typing.html)

~~~
progman
This confirms my own experience. I discovered that programs written in (or
use) dynamic languages like Lisp are surprisingly reliable (Emacs in
particular).

Type safety won't protect us from broken software. Quote: "The most common
bugs caught by static typing are also the least critical sort of bug."

Source: [http://www.drmaciver.com/2016/10/static-typing-will-not-
save...](http://www.drmaciver.com/2016/10/static-typing-will-not-save-us-from-
broken-software/)

Static typing helps a lot to catch basic type errors but it is surely not the
"Messiah" of code safety. In big systems the good old way of testing still
seems to be the best practical way.

Haskell's claim "If it runs then it's likely correct" is a deception because
no compiler can catch logical errors. This was also Ada's problem in the
Ariane disaster, although Ada has probably the strongest type system beside
Haskell. You need special verification tools like FramaC, and even those tools
don't catch all errors. Haskell's safety is even more questionable in face of
the underlying libraries which are written in C. Finally, the still unresolved
Cabal hell speaks for itself. Stack works only because it is an isolated
repository where the maintainers have to take a lot of attention to make sure
that new code doesn't break other code.

~~~
dllthomas
> Haskell's claim "If it runs then it's likely correct" is a deception

This is missing some context. If we generate random functions until we find
one that compiles, of course it's not "likely correct". But that's not what
people are doing - they are setting out to write correct code. If the types
they use exclude functions that are _almost_ correct, then it's likely when
they actually hit something that compiles it will also be something that's
correct. All of that said, it's true that the claim is sometimes made more
strongly than it deserves to be.

> because no compiler can catch logical errors.

Not without my help. But I can certainly write my code such that the compiler
will catch certain logical errors I'm likely to make. I have a pile of
examples, but not the time to elaborate - I'll add them later.

~~~
btam
> I have a pile of examples, but not the time to elaborate - I'll add them
> later.

Please don't forget to share, this sounds very interesting to me as a novice.

~~~
dllthomas
Added as a reply to my earlier comment :)

------
brennen
While this looks appealing and I will probably try it, I'm not sure if I have
cognitive room for another core tool configured in Haskell. Running xmonad is
already like a commitment to periodic skirmishes with an angry badger.

~~~
ChrisPenner
Haha; I understand that feeling! It's mostly scripted using combinators made
available by other extensions; you can just chain them together in `do-
notation` to do the things you want.

~~~
brennen
Awright, awright, I'll give it a look. :)

As a kind of generalized comment to the authors of tools written in smart-
people languages: Y'all are great, but I sometimes suspect you'd get broader
adoption of your stuff if you kept in mind that a bunch of us are clever
enough to benefit from your work, but not always clever enough for the tools
you're building it in...

------
gizmo686
Exciting project.

For those people who might be scared off because it is Haskell, I would
encourage you look at the default config. [0]

Apart from import statements and two lines of boilerplate, it is just a
newline deliminated list of modules. The only line that this does not apply to
is the last line, which sets the initial state of the buffer.

Writing your own extensions probably will always involve being comfortable
with Haskell, but (assuming it gets a decent community) will not be nessasary
for the majority of users.

[0] [https://github.com/ChrisPenner/rasa/blob/master/rasa-
example...](https://github.com/ChrisPenner/rasa/blob/master/rasa-example-
config/app/Main.hs)

------
visarga
Does the name mean "aroma" or "flavor" (from Sanskrit), or has another meaning
altogether?

~~~
rimantas
In Lithuanian "rasa" means "dew". And you can find many similarities between
Lithuanian being one of the oldest languages and sanskrit.

~~~
Koshkin
> _Lithuanian being one of the oldest languages_

How do you figure? According to Wikipedia, "the Eastern Baltic languages split
from the Western Baltic ones between AD 400 and AD 600", "The differentiation
between Lithuanian and Latvian started after AD 800", "The earliest surviving
written Lithuanian text is a translation dating from about 1503–1525", etc.

~~~
colechristensen
Lithuanian is closest to the original proto-indo-european language keeping
more of it's features than any of the hundreds of other languages that spawned
out of it.

It's hard to say any language is "oldest" because languages are alive and the
people that speak them change constantly. The pieces that make up the language
though are indeed very old regardless of the fact that "Lithuanian" hasn't
existed nearly as long.

>Among Indo-European languages, Lithuanian is extraordinarily conservative,
retaining many archaic features otherwise found only in ancient languages such
as Sanskrit[5] or Ancient Greek. For this reason, it is one of the most
important sources in the reconstruction of the Proto-Indo-European language
despite its late attestation (with the earliest texts dating only to c. 1500
AD). The phonology and especially the nominal morphology of Lithuanian is
almost certainly the most conservative of any living Indo-European
language,[4][6] although its verbal morphology is less conservative and may be
exceeded by the conservatism of Modern Greek verbs, which maintain a number of
archaic features lacking in Lithuanian, such as the synthetic aorist and
mediopassive forms.

~~~
gnipgnip
An artifice-ial language constructed based on ostensible ideological
"homeland" based in the Baltics, is closest to one of the Baltic languages ?

Gee, you don't say.

~~~
barrkel
Related languages are different due to changes; but they haven't all changed
in the same way. Thus it is perfectly sound to describe one language as
closest to the common substrate of other related languages.

Here's an abstract example.

    
    
        L1: abcxfgziqk
        L2: qbcdvgxijk
        L3: awcdughrjk
        L4: abcdzghijk
    

Looking only at languages L1 through L3 we may infer a common ancestor from
what is more shared. Saying that L4 is closest to this hypothetical language
is not an empty concept, or artificial based on some ideology.

------
newsat13
This is amazing, I will give it a try over the weekend for sure. Is modular
the selling point here? Last thing I seek in an editor is modularity. This is
like saying my browser is written in some pluggable framework... Who cares as
long as it works?

~~~
michaelmrose
I use my current browser largely because of the extensions for it.

------
Mathnerd314
I followed the code flow a bit:

main loop:
[https://github.com/ChrisPenner/rasa/blob/master/rasa/src/Ras...](https://github.com/ChrisPenner/rasa/blob/master/rasa/src/Rasa.hs)
renderer: [https://github.com/ChrisPenner/rasa/blob/master/rasa-ext-
sla...](https://github.com/ChrisPenner/rasa/blob/master/rasa-ext-
slate/src/Rasa/Ext/Slate/Internal/Render.hs#L27) views:
[https://github.com/ChrisPenner/rasa/blob/2fcb326b646e2f6b01f...](https://github.com/ChrisPenner/rasa/blob/2fcb326b646e2f6b01f8434ab790b632a25f8d00/rasa-
ext-views/src/Rasa/Ext/Views/Internal/Views.hs#L208) buffer references:
[https://github.com/ChrisPenner/rasa/blob/2fcb326b646e2f6b01f...](https://github.com/ChrisPenner/rasa/blob/2fcb326b646e2f6b01f8434ab790b632a25f8d00/rasa/src/Rasa/Internal/Directive.hs#L80)
buffers:
[https://github.com/ChrisPenner/rasa/blob/2fcb326b646e2f6b01f...](https://github.com/ChrisPenner/rasa/blob/2fcb326b646e2f6b01f8434ab790b632a25f8d00/rasa/src/Rasa/Internal/Buffer.hs#L24)

events:
[https://github.com/ChrisPenner/rasa/blob/0b7a037fde31b81d211...](https://github.com/ChrisPenner/rasa/blob/0b7a037fde31b81d211f74475ba0869cbd2226fa/rasa-
ext-slate/src/Rasa/Ext/Slate/Internal/Event.hs#L10) handler:
[https://github.com/ChrisPenner/rasa/blob/b1da88138a68fc2c741...](https://github.com/ChrisPenner/rasa/blob/b1da88138a68fc2c74113d68230290e310db7003/rasa-
ext-vim/src/Rasa/Ext/Vim.hs#L57) typing:
[https://github.com/ChrisPenner/rasa/blob/b1da88138a68fc2c741...](https://github.com/ChrisPenner/rasa/blob/b1da88138a68fc2c74113d68230290e310db7003/rasa-
ext-vim/src/Rasa/Ext/Vim.hs#L99) cursor:
[https://github.com/ChrisPenner/rasa/blob/bb95a3263fc40120edb...](https://github.com/ChrisPenner/rasa/blob/bb95a3263fc40120edbbcb9fe59521b4e362af33/rasa-
ext-cursors/src/Rasa/Ext/Cursors/Actions.hs#L37)

Seems kind of scattered, compared to others such as
[https://hackage.haskell.org/package/qtah-
examples-0.2.0/src/...](https://hackage.haskell.org/package/qtah-
examples-0.2.0/src/src/Graphics/UI/Qtah/Example/Notepad.hs) or
[https://github.com/HeinrichApfelmus/threepenny-
gui/blob/mast...](https://github.com/HeinrichApfelmus/threepenny-
gui/blob/master/samples/Canvas.hs), although of course it's still better than
Yi.

Personally I wouldn't consider it without a GUI supporting variable-width
text, and that seems far away at this point. But if someone writes an OpenGL
renderer it might be worth a second look.

