<commit_before>module Types where

import Symbol

data Kind = Star | Kfun Kind Kind
          deriving (Eq, Show)

data Type = TVar Tyvar | TCon Tycon | TAp Type Type | TGen Int
          deriving (Eq, Show)

data Tyvar = Tyvar Id Kind
           deriving (Eq, Show)

data Tycon = Tycon Id Kind
           deriving (Eq, Show)

tUnit    :: Type
tUnit     = TCon (Tycon "()" Star)
tChar    :: Type
tChar     = TCon (Tycon "Prelude.Char" Star)
tInt     :: Type
tInt      = TCon (Tycon "Int" Star)
tInteger :: Type
tInteger  = TCon (Tycon "Prelude.Integer" Star)
tFloat   :: Type
tFloat    = TCon (Tycon "Float" Star)
tDouble  :: Type
tDouble   = TCon (Tycon "Double" Star)

tBool    :: Type
tBool     = TCon (Tycon "Bool" Star)

tList    :: Type
tList     = TCon (Tycon "[]" (Kfun Star Star))
tArrow   :: Type
tArrow    = TCon (Tycon "(->)" (Kfun Star (Kfun Star Star)))
tTuple2  :: Type
tTuple2   = TCon (Tycon "(,)" (Kfun Star (Kfun Star Star)))

tString :: Type
tString  = list tChar

infixr 4 `fn`
fn :: Type -> Type -> Type
a `fn` b = TAp (TAp tArrow a) b

list :: Type -> Type
list t = TAp tList t

pair :: Type -> Type -> Type
pair a b = TAp (TAp tTuple2 a) b
<commit_msg>src/Types.hs: -4 lines, 0 hints<commit_after>module Types where

import           Symbol

data Kind = Star | Kfun Kind Kind deriving (Eq, Show)

data Type = TVar Tyvar | TCon Tycon | TAp Type Type | TGen Int
          deriving (Eq, Show)

data Tyvar = Tyvar Id Kind deriving (Eq, Show)
data Tycon = Tycon Id Kind deriving (Eq, Show)

tUnit    :: Type
tUnit     = TCon (Tycon "()" Star)
tChar    :: Type
tChar     = TCon (Tycon "Prelude.Char" Star)
tInt     :: Type
tInt      = TCon (Tycon "Int" Star)
tInteger :: Type
tInteger  = TCon (Tycon "Prelude.Integer" Star)
tFloat   :: Type
tFloat    = TCon (Tycon "Float" Star)
tDouble  :: Type
tDouble   = TCon (Tycon "Double" Star)

tBool    :: Type
tBool     = TCon (Tycon "Bool" Star)

tList    :: Type
tList     = TCon (Tycon "[]" (Kfun Star Star))
tArrow   :: Type
tArrow    = TCon (Tycon "(->)" (Kfun Star (Kfun Star Star)))
tTuple2  :: Type
tTuple2   = TCon (Tycon "(,)" (Kfun Star (Kfun Star Star)))

tString :: Type
tString  = list tChar

infixr 4 `fn`
fn :: Type -> Type -> Type
a `fn` b = TAp (TAp tArrow a) b

list :: Type -> Type
list = TAp tList

pair :: Type -> Type -> Type
pair a = TAp (TAp tTuple2 a)

{'fraction_non_alphanumeric': 0.12697734074390765, 'fraction_numerical': 0.004275331338178709, 'mean_word_length': 2.744, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '4366909', 'n_tokens_mistral': 880, 'n_tokens_neox': 876, 'n_words': 320}