<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -12,20 +12,25 @@ import tempfile
 
 dbg = False
 
-input = [line for line in sys.stdin if not line.startswith('| ')]
+ext = sys.argv[1]
+
+input = [line for line in sys.stdin if not line.startswith('-- | ')]
 if input and not input[-1].endswith('\n'):
     input[-1] += '\n'
 input.append('\n')
-input.append('&gt; aouhtnuoeahn = 0 -- Make sure the file has *some* code.\n')
+if ext == '.hs':
+    input.append('aouhtnuoeahn = 0 -- Make sure the file has *some* code.\n')
+else:
+    input.append('&gt; aouhtnuoeahn = 0 -- Make sure the file has *some* code.\n')
 
 module_name = 'Main'
 defn_lines = []
 eval_line_numbers = []
 eval_lines = []
 for i, line in enumerate(input):
-    if line.startswith(')'):
+    if line.startswith('--- '):
         eval_line_numbers.append(i+1)
-        eval_lines.append(line[1:])
+        eval_lines.append(line[len('--- '):])
     else:
         m = re.search(r'module (.*) where', line) # TODO: more specific
         if m:
@@ -36,7 +41,7 @@ if dbg:
     print eval_line_numbers
     print ''.join(eval_lines)
 
-fd, main_lhs = tempfile.mkstemp('.lhs')
+fd, main_lhs = tempfile.mkstemp(ext)
 try:
     os.write(fd, ''.join(defn_lines))
     os.close(fd)
@@ -70,11 +75,11 @@ for j, r in enumerate(result_lines):
         output_line_num = (error_line_num
                            + count(lnum &lt; error_line_num
                                    for lnum in eval_line_numbers))
-        output.insert(output_line_num, '| At column %s:\n' % m.group(2))
+        output.insert(output_line_num, '-- | At column %s:\n' % m.group(2))
         output_line_num += 1
         for plaint_line in result_lines[j+1:]:
             if plaint_line.startswith('Failed, modules loaded:'): break
-            output.insert(output_line_num, '| %s\n' % plaint_line)
+            output.insert(output_line_num, '-- | %s\n' % plaint_line)
             output_line_num += 1
         break
     if r.startswith(prompt):
@@ -83,7 +88,7 @@ for j, r in enumerate(result_lines):
             if r.startswith(prompt):
                 result = r[len(prompt):]
                 if result.startswith('Leaving GHCi.'): break
-                output.insert(eval_line_numbers[i] + i, '| %s\n' % result)
+                output.insert(eval_line_numbers[i] + i, '-- | %s\n' % result)
                 i += 1
         break
 </diff>
      <filename>ghcihalp.py</filename>
    </modified>
    <modified>
      <diff>@@ -3,19 +3,22 @@
 (defvar halp-helpers-directory &quot;/Users/darius/git/halp/&quot;
   &quot;Directory where Halp helper scripts are installed.&quot;)
 
-(defun halp-add-hook (hook map-name key helper-command)
+(defun halp-add-hook (hook map-name key helper-command args)
   (add-hook hook
             `(lambda ()
                (define-key ,map-name ',key
                  (lambda ()
                    (interactive)
-                   (halp-update ',helper-command))))))
+                   (halp-update ',helper-command ',args))))))
 
 (halp-add-hook 'sh-mode-hook 'sh-mode-map
-               &quot;\M-i&quot; (concat halp-helpers-directory &quot;sh-halp.sh&quot;))
+               &quot;\M-i&quot; (concat halp-helpers-directory &quot;sh-halp.sh&quot;) '())
 
 (halp-add-hook 'haskell-mode-hook 'haskell-mode-map
-               &quot;\M-i&quot; (concat halp-helpers-directory &quot;ghcihalp.py&quot;))
+               &quot;\M-i&quot; (concat halp-helpers-directory &quot;ghcihalp.py&quot;) '(&quot;.hs&quot;))
+
+(halp-add-hook 'literate-haskell-mode-hook 'literate-haskell-mode-map
+               &quot;\M-i&quot; (concat halp-helpers-directory &quot;ghcihalp.py&quot;) '(&quot;.lhs&quot;))
 
 
 ;; The rest of this file shouldn't need editing.
@@ -26,13 +29,14 @@
 
 (require 'cl)
 
-(defun halp-update (command)
+(defun halp-update (command args)
   &quot;Update the current buffer using an external helper program.&quot;
   (interactive)
   (let ((output (halp-get-output-buffer)))
 ;;    (call-process-region (point-min) (point-max) &quot;cat&quot; t t)
-    (let ((rc (call-process-region (point-min) (point-max)
-                                   command nil output)))
+    (let ((rc (apply 'call-process-region
+                     (point-min) (point-max) command nil output nil 
+                     args)))
       (cond ((zerop rc)                 ;success
              (halp-update-current-buffer output)
              (message &quot;hooray&quot;))</diff>
      <filename>halp.el</filename>
    </modified>
    <modified>
      <diff>@@ -6,18 +6,18 @@ following ones.
 
 &gt; isPerfectMedian m n = sum [1..m-1] == sum [m+1..n]
 
-) isPerfectMedian 6 8
-| True
-) isPerfectMedian 7 9
-| False
+--- isPerfectMedian 6 8
+-- | True
+--- isPerfectMedian 7 9
+-- | False
 
 Let's try finding some, in a really stupid way, to start.
 
 &gt; findMediansSlowly limit =
 &gt;     [(m, n) | n &lt;- [1..limit], m &lt;- [1..n-1], isPerfectMedian m n]
 
-) findMediansSlowly 50
-| [(6,8),(35,49)]
+--- findMediansSlowly 50
+-- | [(6,8),(35,49)]
 
 OK, a little bit cleverer now:
 
@@ -31,15 +31,15 @@ OK, a little bit cleverer now:
 &gt;      then [(m, n)]       
 &gt;      else []
 
-) faster 500
-| [(6,8),(35,49),(204,288)]
+--- faster 500
+-- | [(6,8),(35,49),(204,288)]
 
 &gt; findAbove m below =
 &gt;   head $ dropWhile (\ (i, s) -&gt; s &lt; below)
 &gt;                    (iterate (\ (i, s) -&gt; (i+1, s+i+1)) (m, 0))
 
-) findAbove 6 15
-| (8,15)
+--- findAbove 6 15
+-- | (8,15)
 
 (Pardon the horrible code; even I can write better, but the idea was
 (to play with Halp as a tool and not focus on code quality.)</diff>
      <filename>perfectmedians.lhs</filename>
    </modified>
    <modified>
      <diff>@@ -2,8 +2,8 @@ Hello, this is a sample.
 
 &gt; fact n = product [1..n]
 
-When you hit M-i you should see '| 120' appear below the following line:
+When you hit M-i you should see '-- | 120' appear below the following line:
 
-) fact (2 + 3)
+--- fact (2 + 3)
 
 OK.</diff>
      <filename>sample.lhs</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>24da2bdff53bed78ae7652c8af390fe492e30230</id>
    </parent>
  </parents>
  <author>
    <name>darius</name>
    <email>darius@68-190-209-27.dhcp.gldl.ca.charter.com</email>
  </author>
  <url>http://github.com/darius/halp/commit/f755d23b20d11b49ba64c681088594c9f591034f</url>
  <id>f755d23b20d11b49ba64c681088594c9f591034f</id>
  <committed-date>2008-08-22T18:57:52-07:00</committed-date>
  <authored-date>2008-08-22T18:57:52-07:00</authored-date>
  <message>support both .lhs and .hs files; change to a syntax that works for both</message>
  <tree>2ca18bf93f5a0a29ceec59e7570f9b7808bd2a55</tree>
  <committer>
    <name>darius</name>
    <email>darius@68-190-209-27.dhcp.gldl.ca.charter.com</email>
  </committer>
</commit>
