<commit_before>{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS -Wall #-}
-- | An extension module of building blocks. Contains booleans, comparison operations, branchings.

module Language.Paraiso.OM.Builder.Boolean
  (eq, ne, lt, le, gt, ge, select) where


import qualified Algebra.Ring as Ring
import qualified Algebra.Additive as Additive
import Data.Dynamic (Typeable)
import qualified Language.Paraiso.OM.Arithmetic as A
import Language.Paraiso.OM.Builder.Internal
import Language.Paraiso.OM.DynValue as DVal
import Language.Paraiso.OM.Graph
import Language.Paraiso.OM.Realm as Realm
import Language.Paraiso.OM.Value as Val
import Language.Paraiso.Tensor
import NumericPrelude


-- | generate a binary operator that returns Bool results.
mkOp2B :: (Vector v, Ring.C g, TRealm r, Typeable c, Additive.C c) => 
          A.Operator                   -- ^The operation to be performed
       -> (Builder v g (Value r c))    -- ^The first argument
       -> (Builder v g (Value r c))    -- ^The second argument
       -> (Builder v g (Value r Bool)) -- ^The result
mkOp2B op builder1 builder2 = do
  v1 <- builder1
  v2 <- builder2
  let 
      r1 = Val.realm v1
  n1 <- valueToNode v1
  n2 <- valueToNode v2
  n0 <- addNode [n1, n2] (NInst (Arith op) ())
  n01 <- addNode [n0] (NValue (toDyn v1) ())
  return $ FromNode r1 True n01


eq, ne, lt, le, gt, ge :: (Vector v, Ring.C g, TRealm r, Typeable c, Additive.C c) => 
                          (Builder v g (Value r c)) -> (Builder v g (Value r c)) -> (Builder v g (Value r Bool))

-- | Equal<commit_msg>type of comparison operators are fixed to bool.<commit_after>{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS -Wall #-}
-- | An extension module of building blocks. Contains booleans, comparison operations, branchings.

module Language.Paraiso.OM.Builder.Boolean
  (eq, ne, lt, le, gt, ge, select) where


import qualified Algebra.Ring as Ring
import qualified Algebra.Additive as Additive
import Data.Dynamic (Typeable, typeOf)
import qualified Language.Paraiso.OM.Arithmetic as A
import Language.Paraiso.OM.Builder.Internal
import Language.Paraiso.OM.DynValue as DVal
import Language.Paraiso.OM.Graph
import Language.Paraiso.OM.Realm as Realm
import Language.Paraiso.OM.Value as Val
import Language.Paraiso.Tensor
import NumericPrelude


-- | generate a binary operator that returns Bool results.
mkOp2B :: (Vector v, Ring.C g, TRealm r, Typeable c, Additive.C c) => 
          A.Operator                   -- ^The operation to be performed
       -> (Builder v g (Value r c))    -- ^The first argument
       -> (Builder v g (Value r c))    -- ^The second argument
       -> (Builder v g (Value r Bool)) -- ^The result
mkOp2B op builder1 builder2 = do
  v1 <- builder1
  v2 <- builder2
  let 
      r1 = Val.realm v1
  n1 <- valueToNode v1
  n2 <- valueToNode v2
  n0 <- addNode [n1, n2] (NInst (Arith op) ())
  n01 <- addNode [n0] (NValue (toDyn v1){typeRep = typeOf True} ())
  return $ FromNode r1 True n01


eq, ne, lt, le, gt, ge :: (Vector v, Ring.C g, TRealm r, Typeable c, Additive.C c) => 
                          (Builder v g (Value r c)) -> (Builder v g (Value r c)) -> (Builder v g (Value r Bool))

-- | Equal
{'fraction_non_alphanumeric': 0.11278667923342758, 'fraction_numerical': 0.015080113100848256, 'mean_word_length': 2.8971848225214196, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '509879', 'n_tokens_mistral': 1108, 'n_tokens_neox': 1055, 'n_words': 383}