Next: Getting Help and Reporting Bugs, Previous: REPL, Up: Top [Index]
This is hs-minor-mode
for haskell-mode
. This module uses
hideshow module.
To activate this minor mode (haskell-collapse-mode)
This minor mode works with indentation.
In a quick glance:
is bound to haskell-hide-toggle
are all bound to haskell-hide-toggle-all
How to use M-x haskell-hide-toggle
?
Place your point on the code block that you want to collapse and hit the keybinding. Now the code collapses and you can see the first line of the block and elipsis.
Take this example code (example usage of M-x haskell-hide-toggle
):
when you place the cursor here, like this (notice the thick block in the
first line):
f█x
| rem i 3 == 0 = if i == 0 && (k /= 0) then (c k) else (h j)
| otherwise = 0
where i = sum x
j = g x (div i 3) 0 0 []
k = zeroes x 0
or
f x
| rem i 3 == 0 = if i == 0 && (k /= 0) then (c k) else (h j)
█ | otherwise = 0
where i = sum x
j = g x (div i 3) 0 0 []
k = zeroes x 0
then when you collapse it becomes something like this:
f█x…
It works in terms of (indentation) blocks.
One more example:
f x
| rem i 3 == 0 = if i == 0 && (k /= 0) then (c k) else (h j)
| otherwise = 0
w█ere i = sum x
j = g x (div i 3) 0 0 []
k = zeroes x 0
or
f x
| rem i 3 == 0 = if i == 0 && (k /= 0) then (c k) else (h j)
| otherwise = 0
where i = sum x
j = g x (div i 3) 0 0 []
█ k = zeroes x 0
this, will result in something like:
f x
| rem i 3 == 0 = if i == 0 && (k /= 0) then (c k) else (h j)
| otherwise = 0
where i = sum █…
The other functionality M-x haskell-hide-toggle-all
also
works only for indentation and it collapses all toplevel functions.
So a file that looks like this:
main = interact $ show.f. map read .words f (x:xs) = dp x xs dp money a | money < 0 || null a = [1..1000] dp 0 a = [] dp money a @ (coin:coins) | (length i) <= length j = i | otherwise = j where i = (coin:(dp (money-coin) a)) j = (dp money coins)
will turn into this:
main = interact $ show.f. map read .words f (x:xs) = dp x xs dp money a | money < 0 || null a = [1..1000] dp 0 a = [] dp money a @ (coin:coins)…
Next: Getting Help and Reporting Bugs, Previous: REPL, Up: Top [Index]