BingWallpapers: Fetches and applies the image of the day from Bing as the wallpaper I have written a small desktop program nabeelomer/BingWallpapers in Haskell. This is my first time writing Haskell.

I was wondering how I can make the code use more functional programming features/idioms/patterns.

Any other suggestions on how to improve the code are also welcome.

-- Copyright (C) Nabeel Omer 2017
-- See the LICENSE file for the license
--

import Network.HTTP.Conduit
import System.Process
import qualified Data.ByteString.Lazy.Char8 as L8
import GHC.IO.Exception

main :: IO ()
main = do
    -- using http://muzzammil.xyz/git/bing/
    metadata &lt;- get "http://cdn.muzzammil.xyz/bing/bing.php?format=text&amp;cc=IN"

    -- Guaranteed by the API
    putStrLn $ (split '&gt;' $ (lines $ L8.unpack metadata)!!1)!!1
    let url = (lines $ L8.unpack metadata)!!0
    picture &lt;- get $ (split '&gt;' url)!!1

    L8.writeFile "/dev/shm/Bing-Wallpaper" picture
    exitcode &lt;- setWallpaper "/dev/shm/Bing-Wallpaper"

    print exitcode
    return ()

-- From StackOverflow
split :: Eq a =&gt; a -&gt; [a] -&gt; [[a]]
split d [] = []
split d s = x : split d (drop 1 y) where (x,y) = span (/= d) s

get :: String -&gt; IO L8.ByteString
get url = simpleHttp url

setWallpaper :: String -&gt; IO GHC.IO.Exception.ExitCode
setWallpaper uri = system $ "gsettings set org.gnome.desktop.background picture-uri file://" ++ uri
Pattern matching instead of !!, inlining of single-use names where straightforward.

import Data.List.Split

main = do
  (_:picurl:_):(_:title:_):_ &lt;- map (wordsBy (=='&gt;')) . lines . L8.unpack
    &lt;$&gt; get "http://cdn.muzzammil.xyz/bing/bing.php?format=text&amp;cc=IN"
  putStrLn title
  L8.writeFile "/dev/shm/Bing-Wallpaper" =&lt;&lt; get picurl
  print =&lt;&lt; setWallpaper "/dev/shm/Bing-Wallpaper"