<commit_before>{-# LANGUAGE TemplateHaskell #-}

module AST where

import Control.Applicative
import Control.Lens
import Control.Monad
import Control.Monad.IO.Class
import Data.Foldable as F
import Data.List
import Data.Monoid
import Data.Traversable as T

infixl 9 :@
infixr 9 ~>

data Expr a = V a  -- Variable
            | L Int  -- Integer literal
            | Expr a :@ Expr a  -- Application
            | Lam a (Expr a)  -- Lambda
            | Let Bool [(Ident, Expr a)] (Expr a)  -- Recursive let binding
            | Case (Expr a) Type [Alt a]
            | Constr Int Type [Expr a]  -- Data constructor (tag and type)
            | PrimFun PrimFun  -- Primitive function
            deriving (Eq,Ord,Show,Read)

data Type = TyFun Type Type
          | TyInt
          | TyVar Ident
          | TyKindStar
          deriving (Eq,Ord,Show,Read)

(~>) :: Type -> Type -> Type
(~>) = TyFun

type Alt a = (Int, [a], Expr a)<commit_msg>Clarify comment on Let constructor<commit_after>{-# LANGUAGE TemplateHaskell #-}

module AST where

import Control.Applicative
import Control.Lens
import Control.Monad
import Control.Monad.IO.Class
import Data.Foldable as F
import Data.List
import Data.Monoid
import Data.Traversable as T

infixl 9 :@
infixr 9 ~>

data Expr a = V a  -- Variable
            | L Int  -- Integer literal
            | Expr a :@ Expr a  -- Application
            | Lam a (Expr a)  -- Lambda
            | Let Bool [(Ident, Expr a)] (Expr a)  -- Let binding. (let rec if true)
            | Case (Expr a) Type [Alt a]
            | Constr Int Type [Expr a]  -- Data constructor (tag and type)
            | PrimFun PrimFun  -- Primitive function
            deriving (Eq,Ord,Show,Read)

data Type = TyFun Type Type
          | TyInt
          | TyVar Ident
          | TyKindStar
          deriving (Eq,Ord,Show,Read)

(~>) :: Type -> Type -> Type
(~>) = TyFun

type Alt a = (Int, [a], Expr a)
{'fraction_non_alphanumeric': 0.10583941605839416, 'fraction_numerical': 0.0020855057351407717, 'mean_word_length': 2.041204437400951, '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': '6555083', 'n_tokens_mistral': 627, 'n_tokens_neox': 611, 'n_words': 214}