hindley-milner-0.1.0.0: Template for Hindley-Milner based languages

Safe HaskellSafe
LanguageHaskell2010

Language.HM.Type

Contents

Description

This module contains the abstract syntax of Hindley-Milner types.

Synopsis

Documentation

Monomorphic types.

type Tau = Fix TauF Source

Monomorphic types.

varT :: String -> Tau Source

varT x constructs a type variable named x.

arrowT :: Tau -> Tau -> Tau Source

arrowT t0 t1 constructs an arrow type from t0 to t1.

Polymorphic types.

type Sigma = Fix SigmaF Source

Polymorphic types.

forAllT :: String -> Sigma -> Sigma Source

forAllT x t universally quantifies x in t.

monoT :: Tau -> Sigma Source

monoT t lifts a monomorophic type t to a polymorphic one.

class HasTypeVars a where Source

The class of types which have free type variables.

Methods

tyVars :: a -> Set String Source

tyVars t calculates the set of free type variables in t.

tyVarsInOrder :: a -> [String] Source

tyVarsInOrder t is like tyVars t, except that the type variables are returned in the order in which they are encountered.