_loadView :: (HasEnvironment m) => CodeType -> CodeMap -> CodeLocation -> [Arg] -> FilePath -> m CodeMap
_loadView ct cmap cl args fp = do
    debugM ("_load : " ++ (show ct) ++ " : " ++ (fst cl) ++ " : " ++ (snd cl))
    ls <- liftIO $ load_ fp [compiledDir] (snd cl)
    case ls of 
                LoadFailure err -> do debugM ("LoadFailure : " ++ (show err))
                                      return (insert cl (CodeLoadFailure $ unlines err) cmap)
                LoadSuccess m f -> do debugM ("LoadSuccess : " ++ fst cl )
                                      liftIO $ unload m
                                      t <- liftIO $ getCurrentTime
                                      case ct of
                                        CTLayout              -> return (insert cl (CodeLoadView f t) cmap)
                                        CTView                -> return (insert cl (CodeLoadView f t) cmap)
                                        CTComponentView       -> return (insert cl (CodeLoadComponentView f t) cmap)
                                        _                     -> error $ "_loadView: passed an invalid CodeType (" ++ (show ct)

-- | Attempt to load the code and return the 'CodeMap' with the newly loaded code in it.  This
-- function is specialized for Controllers.
_loadView :: (HasEnvironment m) => CodeType -> CodeMap -> CodeLocation -> [Arg] -> FilePath -> m CodeMap
_loadView ct cmap cl args fp = do
    debugM ("_load : " ++ (show ct) ++ " : " ++ (fst cl) ++ " : " ++ (snd cl))
    ls <- liftIO $ load_ fp [compiledDir] (snd cl)
    case ls of 
                LoadFailure err -> do debugM ("LoadFailure : " ++ (show err))
                                      return (insert cl (CodeLoadFailure $ unlines err) cmap)
                LoadSuccess m f -> do debugM ("LoadSuccess : " ++ fst cl )
                                      liftIO $ unload m
                                      t <- liftIO $ getCurrentTime
                                      case ct of
                                        CTLayout              -> return (insert cl (CodeLoadView f t) cmap)
                                        CTView                -> return (insert cl (CodeLoadView f t) cmap)
                                        CTComponentView       -> return (insert cl (CodeLoadComponentView f t) cmap)
                                        _                     -> error $ "_loadView: passed an invalid CodeType (" ++ (show ct)

-- | Attempt to load the code and return the 'CodeMap' with the newly loaded code in it.  This
-- function is specialized for Controllers.
_loadView ct cmap cl args fp = do
    debugM ("_load : " ++ (show ct) ++ " : " ++ (fst cl) ++ " : " ++ (snd cl))
    ls <- liftIO $ load_ fp [compiledDir] (snd cl)
    case ls of 
                LoadFailure err -> do debugM ("LoadFailure : " ++ (show err))
                                      return (insert cl (CodeLoadFailure $ unlines err) cmap)
                LoadSuccess m f -> do debugM ("LoadSuccess : " ++ fst cl )
                                      liftIO $ unload m
                                      t <- liftIO $ getCurrentTime
                                      case ct of
                                        CTLayout              -> return (insert cl (CodeLoadView f t) cmap)
                                        CTView                -> return (insert cl (CodeLoadView f t) cmap)
                                        CTComponentView       -> return (insert cl (CodeLoadComponentView f t) cmap)
                                        _                     -> error $ "_loadView: passed an invalid CodeType (" ++ (show ct)

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