It looks like you're new here. If you want to get involved, click one of these buttons!
import Data.List
import System.Cmd
main = do
x <- readFile \"/etc/pacman.d/mirrorlist.pacnew\"
writeFile \"/etc/pacman.d/mirrorlist.backup\" $ unlines (prepareList (lines x))
system \"rankmirrors -n 6 /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist\"
prepareList :: [String] -> [String]
prepareList xss = _prepareList xss \"German\" \"#\" \"Server\"
_prepareList :: Eq a => [[a]] -> [a] -> [a] -> [a] -> [[a]]
_prepareList xss start comment server = case xss of
[] -> []
xs : xss' -> if contains xs start
then [xs] ++ (removeComments xss' comment server)
else [xs] ++ (_prepareList xss' start comment server)
removeComments :: Eq a => [[a]] -> [a] -> [a] -> [[a]]
removeComments xss comment server = case xss of
[] -> []
xs : xss' -> if contains xs server
then [drop 1 xs] ++ (removeComments xss' comment server)
else xs : xss'
contains :: Eq a => [a] -> [a] -> Bool
contains xs [] = True
contains xs (y : ys') = case xs of
[] -> False
x : xs' -> if x == y
then contains xs' ys'
else contains xs' (y : ys')
Haskell was created by mathematicians and because of that is used a lot by mathematicians (i.e. the programs can be very easily mathematically proved to be correct which is what mathematicians need). So I guess a lot implementations are math related. It is also very good for parallel tasks, because the functions usually have no side effects (and if so, they are marked by their type). But you can do anything with it. xmonad, the window manager I use, is written in Haskell.