<commit_before>{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleContexts #-}
{-|
    Module      :  Numeric.AERN.RmToRn.Evaluate
    Description :  operations focusing on function evaluation  
    Copyright   :  (c) <NAME>
    License     :  BSD3

    Maintainer  :  <EMAIL>
    Stability   :  experimental
    Portability :  portable
    
    Operations focusing on function evaluation.
-}

module Numeric.AERN.RmToRn.Evaluation where

import Numeric.AERN.RmToRn.Domain

--import qualified Numeric.AERN.RefinementOrder as RefOrd
--import Numeric.AERN.RefinementOrder.OpsDefaultEffort

import Numeric.AERN.Basics.Effort
import Numeric.AERN.Basics.Consistency

--import Numeric.AERN.Misc.Debug

class (HasDomainBox f) => CanEvaluateOtherType f
    where
    type EvalOps f :: * -> *
    evalOtherType :: (Show t) => (EvalOps f t) -> (VarBox f t) -> f -> t

class (CanEvaluateOtherType f) => CanEvaluateOtherTypeInner f
    where
    evalOtherTypeInner :: 
        (Show t, HasAntiConsistency t) 
        => 
        (EvalOps f t) -> (VarBox f t) -> f -> t

class 
    (CanEvaluateOtherType f,
     EffortIndicator (EvalOpsEffortIndicator f t)) 
    => 
    HasEvalOps f t
    where
    type EvalOpsEffortIndicator f t
    evalOpsDefaultEffort :: f -> t -> EvalOpsEffortIndicator f t
    evalOpsEff :: EvalOpsEffortIndicator f t -> f -> t -> EvalOps f t 

{-
    The following are special cases of the above, which
    can sometimes be implemented more efficiently.
-}

class 
    (HasDomainBox f,
     EffortIndicator (EvaluationEffortIndicator f)) 
    => 
    CanEvaluate f
    where
    type EvaluationEffortIndicator f
    evaluationDefaultEffort :: f -> EvaluationEffortIndicator f
    evalAtPointOutEff :: 
        EvaluationEffortIndicator f -> 
        (DomainBox f) {-^ a sub-domain @A@ where to evaluate -} -> 
        f {-^ function @f@ -} -> 
        (Domain f) {-^ approximated range of @f@ over @A@ -}
    evalAtPointInEff ::
        EvaluationEffortIndicator f -> 
        (DomainBox f) {-^ a sub-domain @A@ where to evaluate -} -> 
        f {-^ function @f@ -} -> 
        (Domain f) {-^ approximated range of @f@ over @A@ -}
    
class 
    (HasDomainBox f,
     EffortIndicator (EvaluationEffortIndicator f)) 
    => 
    CanPartiallyEvaluate f
    where
    type PartialEvaluationEffortIndicator f
    partialEvaluationDefaultEffort :: f -> PartialEvaluationEffortIndicator f
    pEvalAtPointOutEff :: 
        PartialEvaluationEffortIndicator f -> 
        (DomainBox f) {-^ values for some of the variables in @f@ -} -> 
        f {-^ function @f@ -} -> 
        f {-^ approximation of the specialised function in the remaning, unevaluated, variables -}
    pEvalAtPointInEff ::
        PartialEvaluationEffortIndicator f -> <commit_msg>fixed a pasto in type class premises<commit_after>{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleContexts #-}
{-|
    Module      :  Numeric.AERN.RmToRn.Evaluate
    Description :  operations focusing on function evaluation  
    Copyright   :  (c) <NAME>
    License     :  BSD3

    Maintainer  :  <EMAIL>
    Stability   :  experimental
    Portability :  portable
    
    Operations focusing on function evaluation.
-}

module Numeric.AERN.RmToRn.Evaluation where

import Numeric.AERN.RmToRn.Domain

--import qualified Numeric.AERN.RefinementOrder as RefOrd
--import Numeric.AERN.RefinementOrder.OpsDefaultEffort

import Numeric.AERN.Basics.Effort
import Numeric.AERN.Basics.Consistency

--import Numeric.AERN.Misc.Debug

class (HasDomainBox f) => CanEvaluateOtherType f
    where
    type EvalOps f :: * -> *
    evalOtherType :: (Show t) => (EvalOps f t) -> (VarBox f t) -> f -> t

class (CanEvaluateOtherType f) => CanEvaluateOtherTypeInner f
    where
    evalOtherTypeInner :: 
        (Show t, HasAntiConsistency t) 
        => 
        (EvalOps f t) -> (VarBox f t) -> f -> t

class 
    (CanEvaluateOtherType f,
     EffortIndicator (EvalOpsEffortIndicator f t)) 
    => 
    HasEvalOps f t
    where
    type EvalOpsEffortIndicator f t
    evalOpsDefaultEffort :: f -> t -> EvalOpsEffortIndicator f t
    evalOpsEff :: EvalOpsEffortIndicator f t -> f -> t -> EvalOps f t 

{-
    The following are special cases of the above, which
    can sometimes be implemented more efficiently.
-}

class 
    (HasDomainBox f,
     EffortIndicator (EvaluationEffortIndicator f)) 
    => 
    CanEvaluate f
    where
    type EvaluationEffortIndicator f
    evaluationDefaultEffort :: f -> EvaluationEffortIndicator f
    evalAtPointOutEff :: 
        EvaluationEffortIndicator f -> 
        (DomainBox f) {-^ a sub-domain @A@ where to evaluate -} -> 
        f {-^ function @f@ -} -> 
        (Domain f) {-^ approximated range of @f@ over @A@ -}
    evalAtPointInEff ::
        EvaluationEffortIndicator f -> 
        (DomainBox f) {-^ a sub-domain @A@ where to evaluate -} -> 
        f {-^ function @f@ -} -> 
        (Domain f) {-^ approximated range of @f@ over @A@ -}
    
class 
    (HasDomainBox f,
     EffortIndicator (PartialEvaluationEffortIndicator f)) 
    => 
    CanPartiallyEvaluate f
    where
    type PartialEvaluationEffortIndicator f
    partialEvaluationDefaultEffort :: f -> PartialEvaluationEffortIndicator f
    pEvalAtPointOutEff :: 
        PartialEvaluationEffortIndicator f -> 
        (DomainBox f) {-^ values for some of the variables in @f@ -} -> 
        f {-^ function @f@ -} -> 
        f {-^ approximation of the specialised function in the remaning, unevaluated, variables -}
    pEvalAtPointInEff ::
        PartialEvaluationEffortIndicator f -> 
{'fraction_non_alphanumeric': 0.09665955934612651, 'fraction_numerical': 0.00035536602700781805, 'mean_word_length': 2.6623292127521143, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 69, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '408287', 'n_tokens_mistral': 1847, 'n_tokens_neox': 1775, 'n_words': 484}