jpalardy/vim-slime — pull request #53 by jdiez17 (2014-05-02 13:54:11+00:00)
Title: Haskell fixes

Added support for function guards and `where` clauses.

The following code:

initials :: String -> String -> String
initials first last = "Mr. " ++ [f, l]
where (f:_) = first
(l:_) = last

maximum' :: (Ord a) => [a] -> a
maximum' [] = error "Empty list"
maximum' (x:[]) = x
maximum' (x:xs)
| x > y = x
| otherwise = y
where y = maximum' xs

Produced these commands, before the fix:

:{
let initials :: String -> String -> String
initials first last = "Mr. " ++ [f, l]
where (f:_) = first
(l:_) = last

maximum' :: (Ord a) => [a] -> a
maximum' [] = error "Empty list"
maximum' (x:[]) = x
maximum' (x:xs)
| x > y = x
| otherwise = y
where y = maximum' xs
:}

And after the fix:

:{
let initials :: String -> String -> String
initials first last = "Mr. " ++ [f, l]
where (f:_) = first
(l:_) = last

maximum' :: (Ord a) => [a] -> a
maximum' [] = error "Empty list"
maximum' (x:[]) = x
maximum' (x:xs)
| x > y = x
| otherwise = y
where y = maximum' xs
:}