polytypeable-utils-0.1.0.0: Utilities for polytypeable.

Data.PolyTypeable.Utils

Description

Usage:

 > polyTypeOf id
 a1 -> a1
 > freeTyVars (polyTypeOf id)
 ["a1"]
 > substTyVar ("a1",polyTypeOf(undefined::Int)) (polyTypeOf id)
 Int -> Int
 > polyTypeOf const
 a1 -> a2 -> a1
 > freeTyVars (polyTypeOf const) 
 ["a1","a2"]
 > substManyTyVars [("a1",polyTypeOf(undefined::Int)),("a2",polyTypeOf(undefined::Bool))] (polyTypeOf const)
 Int -> Bool -> Int

Synopsis

Documentation

freeTyVars :: TypeRep -> [String]Source

collect free type variables (e.g. a1, a2, ...) without duplicates

substTyVar :: (String, TypeRep) -> TypeRep -> TypeRepSource

substitue a type variable

substTyVars :: [(String, TypeRep)] -> TypeRep -> TypeRepSource

substitue many type variables