
I have found the following filetype plugin for vim to be incredibly useful when reading core files. unfortunatly the translation is one-way, so if you are in the habit of editing core and feeding it back into ghc, you will be disapointed, but for the (more common?) case of reading core to determine what optimizations have been performed, this is quite nice. you can also copy haskell.vim to ~/.vim/syntax/ghc_core.vim to get basic color syntax highlighting. Is there a way to tell ghc to format core files assuming the screen is very wide? the code ends up in a small ribbon along the right side of the screen at pretty low nesting depths making it harder to read.. John --- add to ~/.vim/filetype.vim if exists("did_load_filetypes") finish endif augroup filetypedetect au! BufNewFile,BufRead *.hsc setfiletype haskell au! BufNewFile,BufRead *.as setfiletype haskell au! BufNewFile,BufRead *.pappy setfiletype haskell au! BufNewFile,BufRead *.las setfiletype haskell au! BufNewFile,BufRead *.hcr setfiletype ghc_core augroup END --- ghc_core.vim, place in ~/.vim/ftplugins if exists("s:loaded_ghc_core") finish endif let s:loaded_ghc_core = 1 augroup GhcCore autocmd BufReadPost *.hcr cal s:GhcCoretoUTF8() "autocmd BufWritePre *.hcr cal s:UTF8toGhcCore() " autocmd BufWritePost *.hcr cal s:GhcCoretoUTF8() augroup END function s:UTF8toGhcCore() " we can't do this reversably endfunction function s:GhcCoretoUTF8() silent %s/ZL/(/eg silent %s/ZR/)/eg silent %s/ZM/[/eg silent %s/ZN/]/eg silent %s/ZC/:/eg silent %s/ZZ/Z/eg silent %s/zz/z/eg silent %s/za/&/eg silent %s/zb/|/eg silent %s/zc/^/eg silent %s/zd/$/eg silent %s/ze/=/eg silent %s/zg/>/eg silent %s/zh/#/eg silent %s/zi/./eg silent %s/zl/

Great! Reading core gives you headaches for the first couple of weeks :) This should certainly help people. You should ask the haskell.org guys to put a link up at: http://www.haskell.org/libraries/#editormodes -- Don john:
I have found the following filetype plugin for vim to be incredibly useful when reading core files. unfortunatly the translation is one-way, so if you are in the habit of editing core and feeding it back into ghc, you will be disapointed, but for the (more common?) case of reading core to determine what optimizations have been performed, this is quite nice.
you can also copy haskell.vim to ~/.vim/syntax/ghc_core.vim to get basic color syntax highlighting.
Is there a way to tell ghc to format core files assuming the screen is very wide? the code ends up in a small ribbon along the right side of the screen at pretty low nesting depths making it harder to read.. John
--- add to ~/.vim/filetype.vim
if exists("did_load_filetypes") finish endif augroup filetypedetect au! BufNewFile,BufRead *.hsc setfiletype haskell au! BufNewFile,BufRead *.as setfiletype haskell au! BufNewFile,BufRead *.pappy setfiletype haskell au! BufNewFile,BufRead *.las setfiletype haskell au! BufNewFile,BufRead *.hcr setfiletype ghc_core augroup END
--- ghc_core.vim, place in ~/.vim/ftplugins
if exists("s:loaded_ghc_core") finish endif let s:loaded_ghc_core = 1
augroup GhcCore autocmd BufReadPost *.hcr cal s:GhcCoretoUTF8() "autocmd BufWritePre *.hcr cal s:UTF8toGhcCore() " autocmd BufWritePost *.hcr cal s:GhcCoretoUTF8() augroup END
function s:UTF8toGhcCore() " we can't do this reversably endfunction
function s:GhcCoretoUTF8()
silent %s/ZL/(/eg silent %s/ZR/)/eg silent %s/ZM/[/eg silent %s/ZN/]/eg silent %s/ZC/:/eg silent %s/ZZ/Z/eg silent %s/zz/z/eg silent %s/za/&/eg silent %s/zb/|/eg silent %s/zc/^/eg silent %s/zd/$/eg silent %s/ze/=/eg silent %s/zg/>/eg silent %s/zh/#/eg silent %s/zi/./eg silent %s/zl/
" these are debatable, but make things less cluttered. silent %s/GHC\.Prim\.//eg silent %s/GHC\.Base\.//eg silent %s/GHC\.IOBase\.//eg
endfunction
do GhcCore BufRead
-- John Meacham - ???repetae.net???john??? _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
participants (2)
-
dons@cse.unsw.edu.au
-
John Meacham