egison-5.0.0: Programming language with non-linear pattern-matching against non-free data
LicenseMIT
Safe HaskellNone
LanguageGHC2021

Language.Egison.Type.Types

Description

This module defines the type system for Egison.

Synopsis

Documentation

data Type Source #

Egison types

Constructors

TInt

Integer

TMathExpr

MathExpr (mathematical expression, unifies with Integer)

TPolyExpr

PolyExpr (polynomial expression)

TTermExpr

TermExpr (term in polynomial)

TSymbolExpr

SymbolExpr (symbolic variable)

TIndexExpr

IndexExpr (subscript/superscript index)

TFloat

Float (Double)

TBool

Bool

TChar

Char

TString

String

TVar TyVar

Type variable, e.g., a

TTuple [Type]

Tuple type, e.g., (a, b). Unit type () is TTuple []

TCollection Type

Collection type, e.g., [a]

TInductive String [Type]

Inductive data type with type arguments

TTensor Type

Tensor type (only element type is kept). Vector and Matrix are aliases for Tensor

THash Type Type

Hash map type

TMatcher Type

Matcher type, e.g., Matcher a

TFun Type Type

Function type, e.g., a -> b

TIO Type

IO type (for IO actions)

TIORef Type

IORef type

TPort

Port type (file handles)

TAny

Any type (for gradual typing)

Instances

Instances details
Generic Type Source # 
Instance details

Defined in Language.Egison.Type.Types

Associated Types

type Rep Type 
Instance details

Defined in Language.Egison.Type.Types

type Rep Type = D1 ('MetaData "Type" "Language.Egison.Type.Types" "egison-5.0.0-IKLJXBVxR779jp4wYu1Icq" 'False) ((((C1 ('MetaCons "TInt" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TMathExpr" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "TPolyExpr" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "TTermExpr" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TSymbolExpr" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "TIndexExpr" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "TFloat" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TBool" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "TChar" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "TString" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TyVar)))))) :+: (((C1 ('MetaCons "TTuple" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Type])) :+: C1 ('MetaCons "TCollection" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type))) :+: (C1 ('MetaCons "TInductive" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Type])) :+: (C1 ('MetaCons "TTensor" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type)) :+: C1 ('MetaCons "THash" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type))))) :+: ((C1 ('MetaCons "TMatcher" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type)) :+: (C1 ('MetaCons "TFun" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type)) :+: C1 ('MetaCons "TIO" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type)))) :+: (C1 ('MetaCons "TIORef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type)) :+: (C1 ('MetaCons "TPort" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TAny" 'PrefixI 'False) (U1 :: Type -> Type))))))

Methods

from :: Type -> Rep Type x #

to :: Rep Type x -> Type #

Show Type Source # 
Instance details

Defined in Language.Egison.Type.Types

Methods

showsPrec :: Int -> Type -> ShowS #

show :: Type -> String #

showList :: [Type] -> ShowS #

Eq Type Source # 
Instance details

Defined in Language.Egison.Type.Types

Methods

(==) :: Type -> Type -> Bool #

(/=) :: Type -> Type -> Bool #

Ord Type Source # 
Instance details

Defined in Language.Egison.Type.Types

Methods

compare :: Type -> Type -> Ordering #

(<) :: Type -> Type -> Bool #

(<=) :: Type -> Type -> Bool #

(>) :: Type -> Type -> Bool #

(>=) :: Type -> Type -> Bool #

max :: Type -> Type -> Type #

min :: Type -> Type -> Type #

Hashable Type Source # 
Instance details

Defined in Language.Egison.Type.Types

Methods

hashWithSalt :: Int -> Type -> Int #

hash :: Type -> Int #

type Rep Type Source # 
Instance details

Defined in Language.Egison.Type.Types

type Rep Type = D1 ('MetaData "Type" "Language.Egison.Type.Types" "egison-5.0.0-IKLJXBVxR779jp4wYu1Icq" 'False) ((((C1 ('MetaCons "TInt" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TMathExpr" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "TPolyExpr" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "TTermExpr" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TSymbolExpr" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "TIndexExpr" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "TFloat" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TBool" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "TChar" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "TString" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TyVar)))))) :+: (((C1 ('MetaCons "TTuple" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Type])) :+: C1 ('MetaCons "TCollection" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type))) :+: (C1 ('MetaCons "TInductive" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Type])) :+: (C1 ('MetaCons "TTensor" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type)) :+: C1 ('MetaCons "THash" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type))))) :+: ((C1 ('MetaCons "TMatcher" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type)) :+: (C1 ('MetaCons "TFun" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type)) :+: C1 ('MetaCons "TIO" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type)))) :+: (C1 ('MetaCons "TIORef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type)) :+: (C1 ('MetaCons "TPort" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TAny" 'PrefixI 'False) (U1 :: Type -> Type))))))

data TypeScheme Source #

Type scheme for polymorphic types (∀a. C a => Type) Includes type constraints for type class support

Constructors

Forall [TyVar] [Constraint] Type 

Instances

Instances details
Generic TypeScheme Source # 
Instance details

Defined in Language.Egison.Type.Types

Associated Types

type Rep TypeScheme 
Instance details

Defined in Language.Egison.Type.Types

Show TypeScheme Source # 
Instance details

Defined in Language.Egison.Type.Types

Eq TypeScheme Source # 
Instance details

Defined in Language.Egison.Type.Types

type Rep TypeScheme Source # 
Instance details

Defined in Language.Egison.Type.Types

newtype TyVar Source #

Type variable

Constructors

TyVar String 

Instances

Instances details
Generic TyVar Source # 
Instance details

Defined in Language.Egison.Type.Types

Associated Types

type Rep TyVar 
Instance details

Defined in Language.Egison.Type.Types

type Rep TyVar = D1 ('MetaData "TyVar" "Language.Egison.Type.Types" "egison-5.0.0-IKLJXBVxR779jp4wYu1Icq" 'True) (C1 ('MetaCons "TyVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))

Methods

from :: TyVar -> Rep TyVar x #

to :: Rep TyVar x -> TyVar #

Show TyVar Source # 
Instance details

Defined in Language.Egison.Type.Types

Methods

showsPrec :: Int -> TyVar -> ShowS #

show :: TyVar -> String #

showList :: [TyVar] -> ShowS #

Eq TyVar Source # 
Instance details

Defined in Language.Egison.Type.Types

Methods

(==) :: TyVar -> TyVar -> Bool #

(/=) :: TyVar -> TyVar -> Bool #

Ord TyVar Source # 
Instance details

Defined in Language.Egison.Type.Types

Methods

compare :: TyVar -> TyVar -> Ordering #

(<) :: TyVar -> TyVar -> Bool #

(<=) :: TyVar -> TyVar -> Bool #

(>) :: TyVar -> TyVar -> Bool #

(>=) :: TyVar -> TyVar -> Bool #

max :: TyVar -> TyVar -> TyVar #

min :: TyVar -> TyVar -> TyVar #

Hashable TyVar Source # 
Instance details

Defined in Language.Egison.Type.Types

Methods

hashWithSalt :: Int -> TyVar -> Int #

hash :: TyVar -> Int #

type Rep TyVar Source # 
Instance details

Defined in Language.Egison.Type.Types

type Rep TyVar = D1 ('MetaData "TyVar" "Language.Egison.Type.Types" "egison-5.0.0-IKLJXBVxR779jp4wYu1Icq" 'True) (C1 ('MetaCons "TyVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))

data TensorShape Source #

Tensor shape (dimension sizes)

Constructors

ShapeLit [Integer]

Concrete shape, e.g., [2, 2]

ShapeVar String

Shape variable, e.g., ns in zeroTensor

ShapeMixed [ShapeDimType]

Mixed shape, e.g., [n, m, 2]

ShapeUnknown

To be inferred

Instances

Instances details
Generic TensorShape Source # 
Instance details

Defined in Language.Egison.Type.Types

Associated Types

type Rep TensorShape 
Instance details

Defined in Language.Egison.Type.Types

type Rep TensorShape = D1 ('MetaData "TensorShape" "Language.Egison.Type.Types" "egison-5.0.0-IKLJXBVxR779jp4wYu1Icq" 'False) ((C1 ('MetaCons "ShapeLit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Integer])) :+: C1 ('MetaCons "ShapeVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))) :+: (C1 ('MetaCons "ShapeMixed" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ShapeDimType])) :+: C1 ('MetaCons "ShapeUnknown" 'PrefixI 'False) (U1 :: Type -> Type)))
Show TensorShape Source # 
Instance details

Defined in Language.Egison.Type.Types

Eq TensorShape Source # 
Instance details

Defined in Language.Egison.Type.Types

Ord TensorShape Source # 
Instance details

Defined in Language.Egison.Type.Types

Hashable TensorShape Source # 
Instance details

Defined in Language.Egison.Type.Types

type Rep TensorShape Source # 
Instance details

Defined in Language.Egison.Type.Types

type Rep TensorShape = D1 ('MetaData "TensorShape" "Language.Egison.Type.Types" "egison-5.0.0-IKLJXBVxR779jp4wYu1Icq" 'False) ((C1 ('MetaCons "ShapeLit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Integer])) :+: C1 ('MetaCons "ShapeVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))) :+: (C1 ('MetaCons "ShapeMixed" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ShapeDimType])) :+: C1 ('MetaCons "ShapeUnknown" 'PrefixI 'False) (U1 :: Type -> Type)))

data ShapeDimType Source #

Shape dimension (can be concrete or variable)

Constructors

DimLit Integer

Concrete dimension, e.g., 2

DimVar String

Dimension variable, e.g., n

Instances

Instances details
Generic ShapeDimType Source # 
Instance details

Defined in Language.Egison.Type.Types

Associated Types

type Rep ShapeDimType 
Instance details

Defined in Language.Egison.Type.Types

type Rep ShapeDimType = D1 ('MetaData "ShapeDimType" "Language.Egison.Type.Types" "egison-5.0.0-IKLJXBVxR779jp4wYu1Icq" 'False) (C1 ('MetaCons "DimLit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)) :+: C1 ('MetaCons "DimVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))
Show ShapeDimType Source # 
Instance details

Defined in Language.Egison.Type.Types

Eq ShapeDimType Source # 
Instance details

Defined in Language.Egison.Type.Types

Ord ShapeDimType Source # 
Instance details

Defined in Language.Egison.Type.Types

Hashable ShapeDimType Source # 
Instance details

Defined in Language.Egison.Type.Types

type Rep ShapeDimType Source # 
Instance details

Defined in Language.Egison.Type.Types

type Rep ShapeDimType = D1 ('MetaData "ShapeDimType" "Language.Egison.Type.Types" "egison-5.0.0-IKLJXBVxR779jp4wYu1Icq" 'False) (C1 ('MetaCons "DimLit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)) :+: C1 ('MetaCons "DimVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))

data Constraint Source #

Type class constraint, e.g., "Eq a"

Constructors

Constraint 

Fields

Instances

Instances details
Generic Constraint Source # 
Instance details

Defined in Language.Egison.Type.Types

Associated Types

type Rep Constraint 
Instance details

Defined in Language.Egison.Type.Types

type Rep Constraint = D1 ('MetaData "Constraint" "Language.Egison.Type.Types" "egison-5.0.0-IKLJXBVxR779jp4wYu1Icq" 'False) (C1 ('MetaCons "Constraint" 'PrefixI 'True) (S1 ('MetaSel ('Just "constraintClass") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "constraintType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type)))
Show Constraint Source # 
Instance details

Defined in Language.Egison.Type.Types

Eq Constraint Source # 
Instance details

Defined in Language.Egison.Type.Types

type Rep Constraint Source # 
Instance details

Defined in Language.Egison.Type.Types

type Rep Constraint = D1 ('MetaData "Constraint" "Language.Egison.Type.Types" "egison-5.0.0-IKLJXBVxR779jp4wYu1Icq" 'False) (C1 ('MetaCons "Constraint" 'PrefixI 'True) (S1 ('MetaSel ('Just "constraintClass") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "constraintType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type)))

data ClassInfo Source #

Information about a type class

Constructors

ClassInfo 

Fields

Instances

Instances details
Generic ClassInfo Source # 
Instance details

Defined in Language.Egison.Type.Types

Associated Types

type Rep ClassInfo 
Instance details

Defined in Language.Egison.Type.Types

type Rep ClassInfo = D1 ('MetaData "ClassInfo" "Language.Egison.Type.Types" "egison-5.0.0-IKLJXBVxR779jp4wYu1Icq" 'False) (C1 ('MetaCons "ClassInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "classSupers") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]) :*: (S1 ('MetaSel ('Just "classParam") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TyVar) :*: S1 ('MetaSel ('Just "classMethods") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(String, Type)]))))
Show ClassInfo Source # 
Instance details

Defined in Language.Egison.Type.Types

Eq ClassInfo Source # 
Instance details

Defined in Language.Egison.Type.Types

type Rep ClassInfo Source # 
Instance details

Defined in Language.Egison.Type.Types

type Rep ClassInfo = D1 ('MetaData "ClassInfo" "Language.Egison.Type.Types" "egison-5.0.0-IKLJXBVxR779jp4wYu1Icq" 'False) (C1 ('MetaCons "ClassInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "classSupers") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]) :*: (S1 ('MetaSel ('Just "classParam") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TyVar) :*: S1 ('MetaSel ('Just "classMethods") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(String, Type)]))))

data InstanceInfo Source #

Information about a type class instance

Constructors

InstanceInfo 

Fields

Instances

Instances details
Generic InstanceInfo Source # 
Instance details

Defined in Language.Egison.Type.Types

Associated Types

type Rep InstanceInfo 
Instance details

Defined in Language.Egison.Type.Types

type Rep InstanceInfo = D1 ('MetaData "InstanceInfo" "Language.Egison.Type.Types" "egison-5.0.0-IKLJXBVxR779jp4wYu1Icq" 'False) (C1 ('MetaCons "InstanceInfo" 'PrefixI 'True) ((S1 ('MetaSel ('Just "instContext") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Constraint]) :*: S1 ('MetaSel ('Just "instClass") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :*: (S1 ('MetaSel ('Just "instType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type) :*: S1 ('MetaSel ('Just "instMethods") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(String, ())]))))
Show InstanceInfo Source # 
Instance details

Defined in Language.Egison.Type.Types

Eq InstanceInfo Source # 
Instance details

Defined in Language.Egison.Type.Types

type Rep InstanceInfo Source # 
Instance details

Defined in Language.Egison.Type.Types

type Rep InstanceInfo = D1 ('MetaData "InstanceInfo" "Language.Egison.Type.Types" "egison-5.0.0-IKLJXBVxR779jp4wYu1Icq" 'False) (C1 ('MetaCons "InstanceInfo" 'PrefixI 'True) ((S1 ('MetaSel ('Just "instContext") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Constraint]) :*: S1 ('MetaSel ('Just "instClass") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :*: (S1 ('MetaSel ('Just "instType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type) :*: S1 ('MetaSel ('Just "instMethods") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(String, ())]))))

freshTyVar :: String -> Int -> TyVar Source #

Generate a fresh type variable with a given prefix

freeTyVars :: Type -> Set TyVar Source #

Get free type variables from a type

isTensorType :: Type -> Bool Source #

Check if a type is a tensor type

isScalarType :: Type -> Bool Source #

Check if a type is a scalar (non-tensor) type

typeToName :: Type -> String Source #

Convert a Type to a string name for dictionary and method naming This is used for generating instance dictionary names and method names E.g., TInt -> Integer, TTensor TInt -> TensorInteger

typeConstructorName :: Type -> String Source #

Get the type constructor name only, without type parameters Used for generating instance dictionary names (e.g., "eqCollection" not "eqCollectiona")

sanitizeMethodName :: String -> String Source #

Sanitize method names for use in identifiers Converts operator symbols to alphanumeric names E.g., "==" -> "eq", "+" -> "plus"

typeExprToType :: TypeExpr -> Type Source #

Convert TypeExpr (from AST) to Type (internal representation)

normalizeInductiveTypes :: Type -> Type Source #

Normalize inductive type names to primitive types if applicable This is used to convert TInductive MathExpr [] to TMathExpr, etc.

capitalizeFirst :: String -> String Source #

Capitalize first character

lowerFirst :: String -> String Source #

Lowercase first character