Script for copying files to the appropriate directory
Notes:


don't use single letter variable names for top level bindings
leave spaces around syntax like = and &lt;-
use meaningful variable names for system values (such as file contents)
inline single uses of tiny functions, such as your findhs e
give your core algorithm, w, a meaningful name
don't use long names for local parameters like filepaths. fs is fine.
use pointfree style for arguments in the final position
use when instead of if .. then ... else return ()
use the filepath library for nice file path construction
your only use of f and g is to compose them. so do that and name the result.
use section syntax for lambdas as function arguments to HOFs
indent consistently
use mapM_ when the result you don't care about.


Resulting in:

import Data.Char
import Data.List
import Control.Monad
import System.Directory
import System.FilePath

clean = takeWhile (\x -&gt; x == 'c' || x == 'h' || isDigit x)
      . dropWhile (/='c')

process path = do
   y &lt;- readFile path

   let a = clean y

   when ("ch" `isPrefixOf` a) $ do
         createDirectoryIfMissing False a
         g &lt;- getCurrentDirectory
         writeFile (g &lt;/&gt; a &lt;/&gt; path) y

main = do
    y &lt;- getCurrentDirectory
    e &lt;- getDirectoryContents y
    mapM_ process $ filter (isSuffixOf ".hs") e