-- | Finds the size of an expression
sizeOf' :: ControlPoint DataEnv -> TypedExpr -> ExprSize
sizeOf' f (TEVar _ id)                              = do
  env <- ask
  case lookup id (dataPositions env) of
    Just (DataPos (Deferred e)) -> sizeOf' f e
    Just (DataPos s)            -> return s
    Nothing                     ->
      case find (\entry -> constructorName entry == id) (constructors env) of
        Just (Constructor _ []) -> return Min
        _                       -> return Unknown
sizeOf' :: ControlPoint DataEnv -> TypedExpr -> ExprSize
sizeOf' f (TEVar _ id)                              = do
  env <- ask
  case lookup id (dataPositions env) of
    Just (DataPos (Deferred e)) -> sizeOf' f e
    Just (DataPos s)            -> return s
    Nothing                     ->
      case find (\entry -> constructorName entry == id) (constructors env) of
        Just (Constructor _ []) -> return Min
        _                       -> return Unknown
sizeOf' f (TEVar _ id)                              = do
  env <- ask
  case lookup id (dataPositions env) of
    Just (DataPos (Deferred e)) -> sizeOf' f e
    Just (DataPos s)            -> return s
    Nothing                     ->
      case find (\entry -> constructorName entry == id) (constructors env) of
        Just (Constructor _ []) -> return Min
        _                       -> return Unknown