Indent

Posted on 2015-07-25 by nbloomf
Tags: literate-haskell, munge

This post is literate Haskell; you can load the source into GHCi and play along.


Indent lines by one space.

module Indent where

import Data.List (lines, intersperse)

indent :: String -> String
indent = concat . intersperse "\n" . map (' ':) . lines

main :: IO ()
main = interact indent