Skip to content

Haskell syntax sugar

Romeo Van Snick edited this page May 29, 2014 · 9 revisions

haskell

There's added support for better Haskell syntax. You could it using -XUnicodeSyntax, but this will possibly drive your coauthors crazy. If you want a less drastic approach and if you're a vim user, you could use vims conceal capabilities as I did in creep.vim:

" set correct conceal
set conceallevel=1
set concealcursor=nvi

" lambda's
syntax match hsLambda "\\" conceal cchar=λ

" function composition
syntax match hsCompose / \. /ms=s+1,me=e-1 conceal cchar=·

" ->
syn match MHArrow   /->/       contains=MHArrowM,MHArrowH
syn match MHArrowM  /-/        contained containedin=MHArrow conceal cchar=-
syn match MHArrowH  /-\@<=>/   contained containedin=MHArrow conceal cchar=

" <-
syn match HMArrow   /<-/       contains=HMArrowM,HMArrowH
syn match HMArrowH  /</        contained containedin=HMArrow conceal cchar=
syn match HMArrowM  /<\@<=-/   contained containedin=HMArrow conceal cchar=-

" =>
syn match DMHArrow   /=>/       contains=DMHArrowM,DMHArrowH
syn match DMHArrowM  /=/        contained containedin=DMHArrow conceal cchar==
syn match DMHArrowH  /=\@<=>/   contained containedin=DMHArrow conceal cchar=

" -<
syn match MTArrow   /-</       contains=MTArrowT,MTArrowM
syn match MTArrowT  /-/        contained containedin=MTArrow conceal cchar=-
syn match MTArrowM  /-\@<=</   contained containedin=MTArrow conceal cchar=

" -<<
syn match MTTArrow   /-<</         contains=MTTArrowT,MTTArrowM
syn match MTTArrowT  /-<</me=s+1   contained containedin=MTTArrow conceal cchar=-
syn match MTTArrowM  /-\@<=</      contained containedin=MTTArrow conceal cchar=
syn match MTTArrowM  /\(-<\)\@<=</ contained containedin=MTTArrow conceal cchar=<

" >-
syn match TMArrow   />-/      contains=TMArrowT,TMArrowM
syn match TMArrowT  />/       contained containedin=TMArrow conceal cchar=
syn match TMArrowM  />\@<=-/  contained containedin=TMArrow conceal cchar=-

 ">>-
syn match TTMArrow   />>-/     contains=TTMArrowT,TTMArrowM
syn match TTMArrowTT  />/      contained containedin=TTMArrow conceal cchar=
syn match TTMArrowT  />\@<=>/  contained containedin=TTMArrow conceal cchar=
syn match TTMArrowM  />\@<=-/  contained containedin=TTMArrow conceal cchar=-
Clone this wiki locally