callGraph' f (TEApp _ g args)                           = do
  env <- ask
  case controlPointFromExpr g (controlPoints env) of -- Is g a function?
    Just target -> do
      let targetData cp = map fst $ controlPointData cp
      let call h argd = (f, zip (targetData h) argd, h)
      argGraphs <- mapM (callGraph' f) args
      argData <- mapM (sizeOf' f) args
      let argPositions = map DataPos argData
      return $ call target argPositions : (concat argGraphs)
    Nothing ->
      case constructorFromExpr g (constructors env) of -- Is g a data constructor?
        Just _  -> do argGraphs <- mapM (callGraph' f) args
                      return $ concat argGraphs
        Nothing ->
          throwError $
           CallGraphError "Called function does not exist. This is a type checking issue."
callGraph' f (TEApp _ g args)                           = do
  env <- ask
  case controlPointFromExpr g (controlPoints env) of -- Is g a function?
    Just target -> do
      let targetData cp = map fst $ controlPointData cp
      let call h argd = (f, zip (targetData h) argd, h)
      argGraphs <- mapM (callGraph' f) args
      argData <- mapM (sizeOf' f) args
      let argPositions = map DataPos argData
      return $ call target argPositions : (concat argGraphs)
    Nothing ->
      case constructorFromExpr g (constructors env) of -- Is g a data constructor?
        Just _  -> do argGraphs <- mapM (callGraph' f) args
                      return $ concat argGraphs
        Nothing ->
          throwError $
           CallGraphError "Called function does not exist. This is a type checking issue."
callGraph' f (TEApp _ g args)                           = do
  env <- ask
  case controlPointFromExpr g (controlPoints env) of -- Is g a function?
    Just target -> do
      let targetData cp = map fst $ controlPointData cp
      let call h argd = (f, zip (targetData h) argd, h)
      argGraphs <- mapM (callGraph' f) args
      argData <- mapM (sizeOf' f) args
      let argPositions = map DataPos argData
      return $ call target argPositions : (concat argGraphs)
    Nothing ->
      case constructorFromExpr g (constructors env) of -- Is g a data constructor?
        Just _  -> do argGraphs <- mapM (callGraph' f) args
                      return $ concat argGraphs
        Nothing ->
          throwError $
           CallGraphError "Called function does not exist. This is a type checking issue."