<commit_before>{-# LANGUAGE TypeFamilies #-}
{-|
    Module      :  Numeric.AERN.BasicTypes
    Description :  auxiliary types for exact real number processing 
    Copyright   :  (c) <NAME>
    License     :  BSD3

    Maintainer  :  <EMAIL>
    Stability   :  experimental
    Portability :  portable

    auxiliary types and classes for exact real number processing
-}
module Numeric.AERN.BasicTypes where

import Control.Monad.ST
import Data.STRef

class CanBeMutable t where
    {-| a mutable version of the type t -}
    type Mutable t :: *
    {-| a monad that the mutable version of t can be modified in -}
    type MutableMonad t :: * -> *

    {-| a thaw operation to make a variable with an initial value -}
    makeMutable :: t -> MutableMonad t (Mutable t)
    {-| a read operation, yielding an immutable value -}
    readMutable :: Mutable t -> MutableMonad t t
    {-| a write/update operation -}
    writeMutable :: Mutable t -> t -> MutableMonad t ()
    {-| execute imperative program involving values of b 
        and escape back to the pure world with the results -}
    runMutable :: MutableMonad t [Mutable t] -> [t]  
-- ??    runMutable :: MutableMonad t a -> a  


{-|
  The bit size of the floating point numbers (or similar)
  used internally in real number and function approximations.
-}
type Granularity = Int
<commit_msg>incorporated ST monad into class CanBeMutable<commit_after>{-# LANGUAGE TypeFamilies #-}
{-|
    Module      :  Numeric.AERN.BasicTypes
    Description :  auxiliary types for exact real number processing 
    Copyright   :  (c) <NAME>
    License     :  BSD3

    Maintainer  :  <EMAIL>
    Stability   :  experimental
    Portability :  portable

    auxiliary types and classes for exact real number processing
-}
module Numeric.AERN.BasicTypes where

import Control.Monad.ST (ST)

class CanBeMutable t where
    {-| a mutable version of the type t; 
        the extra parameter is the state of the ST monad run -}
    type Mutable t :: * -> *

    {-| a thaw operation to make a variable with an initial value -}
    makeMutable :: t -> ST s (Mutable t s)
    {-| a read operation, yielding an immutable value -}
    readMutable :: Mutable t s -> ST s t
    {-| a write/update operation -}
    writeMutable :: Mutable t s -> t -> ST s ()


{-|
  The bit size of the floating point numbers (or similar)
  used internally in real number and function approximations.
-}
type Granularity = Int

{'fraction_non_alphanumeric': 0.08544562551103843, 'fraction_numerical': 0.0008176614881439084, 'mean_word_length': 2.674174174174174, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, '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': '665301', 'n_tokens_mistral': 757, 'n_tokens_neox': 710, 'n_words': 289}