<commit_before>{-# OPTIONS_GHC -Wall #-}
module AST.Declaration where

import AST.V0_16
import qualified AST.Expression as Expression
import qualified AST.Pattern as Pattern
import qualified AST.Variable as Var
import qualified Reporting.Annotation as A


-- DECLARATIONS

data Declaration
    = Definition Pattern.Pattern [(Comments, Pattern.Pattern)] Comments Expression.Expr
    | TypeAnnotation (Var.Ref, Comments) (Comments, Type)
    | Datatype
        (Commented (String, [(Comments, String)]))
        [Commented (String, [(Comments, Type)])]
        (Comments, (String, [(Comments, Type)]))
    | TypeAlias Comments
        (Commented (String, [(Comments, String)]))
        (Comments, Type)
    | PortAnnotation (Commented String) Comments Type
    | PortDefinition (Commented String) Comments Expression.Expr
    | Fixity Assoc Comments Int Comments Var.Ref
    deriving (Eq, Show)


instance A.Strippable Declaration where
  stripRegion d =
    case d of
        Definition a b c e ->
            Definition (A.stripRegion a) b c (A.stripRegion $ A.map A.stripRegion e)
        _ -> d

-- INFIX STUFF

data Assoc = L | N | R
    deriving (Eq, Show)


assocToString :: Assoc -> String
assocToString assoc =
    case assoc of
      L -> "left"
      N -> "non"<commit_msg>Use PreCommented/PostCommented aliases in AST.Declaration<commit_after>{-# OPTIONS_GHC -Wall #-}
module AST.Declaration where

import AST.V0_16
import qualified AST.Expression as Expression
import qualified AST.Pattern as Pattern
import qualified AST.Variable as Var
import qualified Reporting.Annotation as A


-- DECLARATIONS

data Declaration
    = Definition Pattern.Pattern [PreCommented Pattern.Pattern] Comments Expression.Expr
    | TypeAnnotation (PostCommented Var.Ref) (PreCommented Type)
    | Datatype
        (Commented (String, [PreCommented String]))
        [Commented (String, [PreCommented Type])]
        (PreCommented (String, [PreCommented Type]))
    | TypeAlias Comments
        (Commented (String, [PreCommented String]))
        (PreCommented Type)
    | PortAnnotation (Commented String) Comments Type
    | PortDefinition (Commented String) Comments Expression.Expr
    | Fixity Assoc Comments Int Comments Var.Ref
    deriving (Eq, Show)


instance A.Strippable Declaration where
  stripRegion d =
    case d of
        Definition a b c e ->
            Definition (A.stripRegion a) b c (A.stripRegion $ A.map A.stripRegion e)
        _ -> d

-- INFIX STUFF

data Assoc = L | N | R
    deriving (Eq, Show)


assocToString :: Assoc -> String
assocToString assoc =
    case assoc of
      L -> "left"
      N -> "non"
{'fraction_non_alphanumeric': 0.09177456207159178, 'fraction_numerical': 0.002284843869002285, 'mean_word_length': 3.1240188383045524, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '2736017', 'n_tokens_mistral': 787, 'n_tokens_neox': 742, 'n_words': 259}