<commit_before>module Graph.GraphRule (
      graphRule
    , GraphRule
    , left
    , right
    , nacs
) where

import Graph.TypedGraphMorphism (TypedGraphMorphism)
import Abstract.Morphism
import Abstract.Valid

data GraphRule a b = GraphRule {
                          leftSide  :: TypedGraphMorphism a b
                        , rightSide :: TypedGraphMorphism a b
                        , getNacs   :: [TypedGraphMorphism a b]
                     } deriving (Show, Read)

left  = leftSide
right = rightSide
nacs  = getNacs
graphRule = GraphRule

instance Valid (GraphRule a b) where
    valid (GraphRule lside rside nacs) =
        valid lside &&
        valid rside &&
        all valid nacs &&
        (domain lside) == (domain rside)<commit_msg>GraphRule haddock<commit_after>module Graph.GraphRule (
    -- * Types
      GraphRule
    -- * Basic Functions
      graphRule
    , left
    , right
    , nacs
) where

import Graph.TypedGraphMorphism (TypedGraphMorphism)
import Abstract.Morphism
import Abstract.Valid

data GraphRule a b = GraphRule {
                          leftSide  :: TypedGraphMorphism a b
                        , rightSide :: TypedGraphMorphism a b
                        , getNacs   :: [TypedGraphMorphism a b]
                     } deriving (Show, Read)

-- | Return the left-side (deletion) typed graph morphism of the rule.
left  = leftSide
-- | Return the right-side (creation) typed graph morphism of the rule.
right = rightSide
-- | Return a list of all NAC's.
nacs  = getNacs
-- | Create a rule based on both typed graph morphisms and a list of NAC's.
graphRule = GraphRule

instance Valid (GraphRule a b) where
    valid (GraphRule lside rside nacs) =
        valid lside &&
        valid rside &&
        all valid nacs &&
        (domain lside) == (domain rside)
{'fraction_non_alphanumeric': 0.0733186328555678, 'fraction_numerical': 0.0, 'mean_word_length': 2.0762711864406778, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '477075', 'n_tokens_mistral': 534, 'n_tokens_neox': 507, 'n_words': 173}