hask.lang.type_system – The implementation of the type system

class hask.lang.type_system.Hask[source]

Base class for objects within hask.

ADTs, TypedFunc, List, Undefined, and other hask-related types are all subclasses of Hask.

All subclasses must define __type__, which returns a representation of the object in the internal type system language.

class hask.lang.type_system.Undefined[source]

A class with no concrete type definition (so its type can unify with any other type). Used to create undefined and to enable psuedo-laziness in pattern matching.

class hask.lang.type_system.PyFunc[source]

Singleton object that represents (any of the) Python function types in the type system and in type signatures.

hask.lang.type_system.typeof(obj)[source]

Returns the type of an object within the internal type system.

Parameters:obj – the object to inspect
Returns:An object representing the type in the internal type system language (i.e., a TypeOperator or TypeVariable).
class hask.lang.type_system.TypeSignature(args, constraints)[source]

Internal representation of a type signature, consisting of a list of function type arguments and a list of (typeclass, type_variable) typeclass constraint pairs.

class hask.lang.type_system.TypeSignatureHKT(tcon, params)[source]

Internal representation of a higher-kinded type within a type signature, consisting of the type constructor and its type parameter names.

exception hask.lang.type_system.TypeSignatureError[source]
class hask.lang.type_system.TypedFunc(fn, fn_args, fn_type)[source]

Partially applied, statically typed function wrapper.

class hask.lang.type_system.ADT[source]

Base class for Hask algebraic data types.