makeCode :: (HasEnvironment m) => CodeType -> CodeMap -> CodeLocation -> [Arg] -> FilePath -> m CodeMap
makeCode ct cmap cl args fp = do
    ms <- liftIO $ makeAll fp (compileArgs++args)
    case ms of
            MakeFailure err       -> do debugM ("\tMake error : " ++ (show err))
                                        return (insert cl (CodeLoadFailure $ unlines err) cmap)
            MakeSuccess NotReq _  -> do debugM ("\tMake success : No recomp required")
                                        return cmap
            MakeSuccess _      fp -> do debugM ("\tMake success : " ++ fp)
                                        case ct of
                                          CTLayout                -> _loadView ct cmap cl args fp
                                          CTView                  -> _loadView ct cmap cl args fp
                                          CTComponentView         -> _loadView ct cmap cl args fp
                                          CTController            -> _loadController ct cmap cl args fp
                                          CTComponentController   -> _loadController ct cmap cl args fp

-- | Attempt to load the code and return the 'CodeMap' with the newly loaded code in it.  This
-- function is specialized for Views.
makeCode :: (HasEnvironment m) => CodeType -> CodeMap -> CodeLocation -> [Arg] -> FilePath -> m CodeMap
makeCode ct cmap cl args fp = do
    ms <- liftIO $ makeAll fp (compileArgs++args)
    case ms of
            MakeFailure err       -> do debugM ("\tMake error : " ++ (show err))
                                        return (insert cl (CodeLoadFailure $ unlines err) cmap)
            MakeSuccess NotReq _  -> do debugM ("\tMake success : No recomp required")
                                        return cmap
            MakeSuccess _      fp -> do debugM ("\tMake success : " ++ fp)
                                        case ct of
                                          CTLayout                -> _loadView ct cmap cl args fp
                                          CTView                  -> _loadView ct cmap cl args fp
                                          CTComponentView         -> _loadView ct cmap cl args fp
                                          CTController            -> _loadController ct cmap cl args fp
                                          CTComponentController   -> _loadController ct cmap cl args fp

-- | Attempt to load the code and return the 'CodeMap' with the newly loaded code in it.  This
-- function is specialized for Views.
makeCode ct cmap cl args fp = do
    ms <- liftIO $ makeAll fp (compileArgs++args)
    case ms of
            MakeFailure err       -> do debugM ("\tMake error : " ++ (show err))
                                        return (insert cl (CodeLoadFailure $ unlines err) cmap)
            MakeSuccess NotReq _  -> do debugM ("\tMake success : No recomp required")
                                        return cmap
            MakeSuccess _      fp -> do debugM ("\tMake success : " ++ fp)
                                        case ct of
                                          CTLayout                -> _loadView ct cmap cl args fp
                                          CTView                  -> _loadView ct cmap cl args fp
                                          CTComponentView         -> _loadView ct cmap cl args fp
                                          CTController            -> _loadController ct cmap cl args fp
                                          CTComponentController   -> _loadController ct cmap cl args fp

-- | Attempt to load the code and return the 'CodeMap' with the newly loaded code in it.  This
-- function is specialized for Views.