Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few additions to vim-haskellConceal #9

Closed
wants to merge 7 commits into from
Closed

A few additions to vim-haskellConceal #9

wants to merge 7 commits into from

Conversation

enomsg
Copy link
Contributor

@enomsg enomsg commented Jul 30, 2014

Hello,

There were a few changes that I had in my local tree for some time. Recently I've got some time to cleanup and split them for review/pull request.

The changes are logically separated, please see the commit messages for the justification. I guess the main addition is in the following patch:
'Add some more arithmetic, logic, set, type, monoid and monad notation'
The notation there was taken from the base-unicode-symbols package, so it should be pretty universal.
The last two patches in the series are using informal notation (protected by a flag). If you don't like any of the commits, I can remove them from the for-upstream branch and resend.

Thanks!

The patch looks scary but it is actually trivial: instead of having the
huge indented if-block, we can just have

  if !exists('s:extraConceal')
      finish
  endif

at the beginning.

This makes the code less indented/spaghetti-like and somewhat easier to
add other flags.
The circle constant (tau) slowly becomes quite common (it is equal to
2*pi), popularized in Haskell community through the Diagrams package:

  http://projects.haskell.org/diagrams/haddock/Diagrams-Util.html#v:tau

'<<' is commonly used in Text.Html.
We already use 'identical to' for '==', so let's be consistent and use
'not identical to' for '/='. The base-unicode-symbols[1] package uses both
'not equal' and 'not identical'.

[1] http://hackage.haskell.org/package/base-unicode-symbols
Base-unicode-symbols[1] uses dot for multiplication, but most of the time
it's indistinguishable. Let's use 'times' symbol. If anything, it is
better than a star.

[1] http://hackage.haskell.org/package/base-unicode-symbols
Except for 'return' and 'join', all of them already used in

  http://hackage.haskell.org/package/base-unicode-symbols

Eta and Mu are common notations for 'return' and 'join', e.g.

  http://www.euclideanspace.com/maths/discrete/category/higher/monad/index.htm

Even though they are letter-functions (similar to as we use lambda symbol
for '\'), they can be easily made distinguishable from letter-variables by
the colorscheme (using colors or bold type, alike to vectors vs. variables
in math.)
These are not strictly mathematical/agreed upon notation symbols. But they
do the job of making the code less cluttered with the multi-symbols names.

To enable this notation one has to place this line into ~/.vimrc:

  let informal_haskell_conceal=1
Vim has some issues concealing with composite symbols like '«̳', and
unfortunately there is no other common short notation for bind. But for
readability we still want a single-space character. For the time being,
these circled letters/mnemonics might work:

 b - normal bind, to the right (b "looks" to the right)
 d - bind to the left (mirrored b, "looks" to the left)
@Twinside
Copy link
Owner

Twinside commented Aug 4, 2014

I think I'll grab the set and boolean changes (and the div), the rest is too far fetched for a "generic" version.

@Twinside Twinside closed this Aug 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants