<commit_before>function Goal ()

  " Save this file and call the ghc-goals tool in the background with our
  " module and word-under-cursor as arguments.
  silent w
  let cmd    = "ghc-goals " . shellescape(expand("%")) . " -g " . shellescape(expand("<cword>"))
  let output = system(cmd)

  " Join multi-line type signatures.
  let output = substitute(output, "\n\\s\\+", " ", "g")

  " Filter everything that is not related to the current line.
  let list   = split(output, "\n")
  let list   = filter(list, "v:val =~ " . line("."))
  let output = join(list, " ")

  " Filter out the comment from the signature.
  let output = substitute(output, "--.*", "", "g")

  " Print out the type.
  echomsg output

endfunction



" Install goal collector for Haskell and literate Haskell files.

function Install ()
  map <buffer> <F4> :call Goal()<CR> 
endfunction

autocmd BufRead,BufNewFile *.{hs,lhs} call Install()
<commit_msg>Experimental insert type at cursor position.<commit_after>function Goal (replace)

  " Save this file and call the ghc-goals tool in the background with our
  " module and word-under-cursor as arguments.
  silent w
  let cmd    = "ghc-goals " . shellescape(expand("%")) . " -g " . shellescape(expand("<cword>"))
  let output = system(cmd)

  " Join multi-line type signatures.
  let output = substitute(output, "\n\\s\\+", " ", "g")

  " Filter everything that is not related to the current line.
  let list   = split(output, "\n")
  let list   = filter(list, "v:val =~ " . line("."))
  let output = join(list, " ")

  " Filter out the comment from the signature.
  let output = substitute(output, "\\s*--.*", "", "g")

  " Print out the type.
  echomsg output

  if a:replace
    exe "normal ciw(" . output . ")\<esc>"
  endif

endfunction


" Install goal collector for Haskell and literate Haskell files.

function Install ()
  map <buffer> <F4> :call Goal(0)<CR> 
  map <buffer> <F5> :call Goal(1)<CR> 
endfunction

autocmd BufRead,BufNewFile *.{hs,lhs} call Install()

{'fraction_non_alphanumeric': 0.14364364364364365, 'fraction_numerical': 0.0025025025025025025, 'mean_word_length': 3.3456521739130434, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '871307', 'n_tokens_mistral': 679, 'n_tokens_neox': 640, 'n_words': 224}