+ (outName, outDir, outBase) <- case [f | Output f <- flags] of
+ []
+ | not (null ext) &&
+ last ext == 'c' -> return (dir++base++init ext, dir, base)
+ | ext == ".hs" -> return (dir++base++"_out.hs", dir, base)
+ | otherwise -> return (dir++base++".hs", dir, base)
+ where
+ (dir, file) = splitName name
+ (base, ext) = splitExt file
+ [f] -> let
+ (dir, file) = splitName f
+ (base, _) = splitExt file
+ in return (f, dir, base)
+ _ -> onlyOne "output file"