On Sat, Apr 5, 2014, at 11:31 PM, Matt Joiner wrote:
  1. packageBase <- do
  2.     curDir <- getCurrentDirectory
  3.     return . last . splitDirectories . normalise . joinPath $ curDir:maybeToList package
 
Sure. The most obvious transformation to me would have these three steps:
 
1. The right argument of (:) isn't coming from a monadic action, so you can extract it as a section and move it to your big long chain of compositions:
 
return . last . splitDirectories . normalise . joinPath . (: maybeToList package) $ curDir
 
2. Get rid of the binding of curDir:
 
getCurrentDirectory >>= return . last . splitDirectories . normalise . joinPath . (: maybeToList package)
 
3. Notice that the right argument of (>>=) really isn't using your monad, so you could use fmap or (<$>) (assuming this is a well-behaved monad which also has a Functor instance):
 
last . splitDirectories . normalise . joinPath . (: maybeToList package) <$> getCurrentDirectory
 
Fair warning: I'm tired and not type-checking this. But it looks right to me.
 
-Karl