<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--Rendered using the Haskell Html Library v0.2--> <HTML ><HEAD ><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" ><TITLE >Coercion</TITLE ><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" ><SCRIPT SRC="haddock-util.js" TYPE="text/javascript" ></SCRIPT ><SCRIPT TYPE="text/javascript" >window.onload = function () {setSynopsis("mini_Coercion.html")};</SCRIPT ></HEAD ><BODY ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="topbar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " ></TD ><TD CLASS="title" >ghc-6.12.3: The GHC API</TD ><TD CLASS="topbut" ><A HREF="index.html" >Contents</A ></TD ><TD CLASS="topbut" ><A HREF="doc-index.html" >Index</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="modulebar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><FONT SIZE="6" >Coercion</FONT ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="section4" ><B >Contents</B ></TD ></TR ><TR ><TD ><DL ><DT ><A HREF="#1" >Main data type </A ></DT ><DD ><DL ><DT ><A HREF="#2" >Equality predicates </A ></DT ><DT ><A HREF="#3" >Coercion transformations </A ></DT ><DT ><A HREF="#4" >Comparison </A ></DT ></DL ></DD ><DT ><A HREF="#5" >CoercionI </A ></DT ></DL ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Description</TD ></TR ><TR ><TD CLASS="doc" ><P >Module for type coercions, as used in System FC. See CoreSyn.Expr for more on System FC and how coercions fit into it. </P ><P >Coercions are represented as types, and their kinds tell what types the coercion works on. The coercion kind constructor is a special TyCon that must always be saturated, like so: </P ><PRE > typeKind (symCoercion type) :: TyConApp CoercionTyCon{...} [type, type] </PRE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Synopsis</TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >type</SPAN > <A HREF="#t%3ACoercion" >Coercion</A > = <A HREF="Type.html#t%3AType" >Type</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkCoKind" >mkCoKind</A > :: <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="Type.html#t%3AType" >Type</A > -> CoercionKind</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkReflCoKind" >mkReflCoKind</A > :: <A HREF="Type.html#t%3AType" >Type</A > -> CoercionKind</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AsplitCoercionKind_maybe" >splitCoercionKind_maybe</A > :: <A HREF="Type.html#t%3AKind" >Kind</A > -> <A HREF="../base-4.2.0.2/Data-Maybe.html#t%3AMaybe" >Maybe</A > (<A HREF="Type.html#t%3AType" >Type</A >, <A HREF="Type.html#t%3AType" >Type</A >)</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AsplitCoercionKind" >splitCoercionKind</A > :: CoercionKind -> (<A HREF="Type.html#t%3AType" >Type</A >, <A HREF="Type.html#t%3AType" >Type</A >)</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AcoercionKind" >coercionKind</A > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> (<A HREF="Type.html#t%3AType" >Type</A >, <A HREF="Type.html#t%3AType" >Type</A >)</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AcoercionKinds" >coercionKinds</A > :: [<A HREF="Coercion.html#t%3ACoercion" >Coercion</A >] -> ([<A HREF="Type.html#t%3AType" >Type</A >], [<A HREF="Type.html#t%3AType" >Type</A >])</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AcoercionKindPredTy" >coercionKindPredTy</A > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> CoercionKind</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisIdentityCoercion" >isIdentityCoercion</A > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="../base-4.2.0.2/Data-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisEqPred" >isEqPred</A > :: <A HREF="Type.html#t%3APredType" >PredType</A > -> <A HREF="../base-4.2.0.2/Data-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkEqPred" >mkEqPred</A > :: (<A HREF="Type.html#t%3AType" >Type</A >, <A HREF="Type.html#t%3AType" >Type</A >) -> <A HREF="Type.html#t%3APredType" >PredType</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AgetEqPredTys" >getEqPredTys</A > :: <A HREF="Type.html#t%3APredType" >PredType</A > -> (<A HREF="Type.html#t%3AType" >Type</A >, <A HREF="Type.html#t%3AType" >Type</A >)</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisEqPredTy" >isEqPredTy</A > :: <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="../base-4.2.0.2/Data-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkCoercion" >mkCoercion</A > :: <A HREF="TyCon.html#t%3ATyCon" >TyCon</A > -> [<A HREF="Type.html#t%3AType" >Type</A >] -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkSymCoercion" >mkSymCoercion</A > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkTransCoercion" >mkTransCoercion</A > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkLeftCoercion" >mkLeftCoercion</A > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkRightCoercion" >mkRightCoercion</A > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkRightCoercions" >mkRightCoercions</A > :: <A HREF="../base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> [<A HREF="Coercion.html#t%3ACoercion" >Coercion</A >]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkInstCoercion" >mkInstCoercion</A > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkAppCoercion" >mkAppCoercion</A > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkTyConCoercion" >mkTyConCoercion</A > :: <A HREF="TyCon.html#t%3ATyCon" >TyCon</A > -> [<A HREF="Coercion.html#t%3ACoercion" >Coercion</A >] -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkFunCoercion" >mkFunCoercion</A > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkForAllCoercion" >mkForAllCoercion</A > :: <A HREF="Var.html#t%3AVar" >Var</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkInstsCoercion" >mkInstsCoercion</A > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> [<A HREF="Type.html#t%3AType" >Type</A >] -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkUnsafeCoercion" >mkUnsafeCoercion</A > :: <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkNewTypeCoercion" >mkNewTypeCoercion</A > :: <A HREF="Name.html#t%3AName" >Name</A > -> <A HREF="TyCon.html#t%3ATyCon" >TyCon</A > -> [<A HREF="Var.html#t%3ATyVar" >TyVar</A >] -> <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="TyCon.html#t%3ATyCon" >TyCon</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkFamInstCoercion" >mkFamInstCoercion</A > :: <A HREF="Name.html#t%3AName" >Name</A > -> [<A HREF="Var.html#t%3ATyVar" >TyVar</A >] -> <A HREF="TyCon.html#t%3ATyCon" >TyCon</A > -> [<A HREF="Type.html#t%3AType" >Type</A >] -> <A HREF="TyCon.html#t%3ATyCon" >TyCon</A > -> <A HREF="TyCon.html#t%3ATyCon" >TyCon</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkAppsCoercion" >mkAppsCoercion</A > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> [<A HREF="Coercion.html#t%3ACoercion" >Coercion</A >] -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AsplitNewTypeRepCo_maybe" >splitNewTypeRepCo_maybe</A > :: <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="../base-4.2.0.2/Data-Maybe.html#t%3AMaybe" >Maybe</A > (<A HREF="Type.html#t%3AType" >Type</A >, <A HREF="Coercion.html#t%3ACoercion" >Coercion</A >)</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AinstNewTyCon_maybe" >instNewTyCon_maybe</A > :: <A HREF="TyCon.html#t%3ATyCon" >TyCon</A > -> [<A HREF="Type.html#t%3AType" >Type</A >] -> <A HREF="../base-4.2.0.2/Data-Maybe.html#t%3AMaybe" >Maybe</A > (<A HREF="Type.html#t%3AType" >Type</A >, <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A >)</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AdecomposeCo" >decomposeCo</A > :: <A HREF="BasicTypes.html#t%3AArity" >Arity</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> [<A HREF="Coercion.html#t%3ACoercion" >Coercion</A >]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AunsafeCoercionTyCon" >unsafeCoercionTyCon</A > :: <A HREF="TyCon.html#t%3ATyCon" >TyCon</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AsymCoercionTyCon" >symCoercionTyCon</A > :: <A HREF="TyCon.html#t%3ATyCon" >TyCon</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AtransCoercionTyCon" >transCoercionTyCon</A > :: <A HREF="TyCon.html#t%3ATyCon" >TyCon</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AleftCoercionTyCon" >leftCoercionTyCon</A > :: <A HREF="TyCon.html#t%3ATyCon" >TyCon</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3ArightCoercionTyCon" >rightCoercionTyCon</A > :: <A HREF="TyCon.html#t%3ATyCon" >TyCon</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AinstCoercionTyCon" >instCoercionTyCon</A > :: <A HREF="TyCon.html#t%3ATyCon" >TyCon</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AcoreEqCoercion" >coreEqCoercion</A > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="../base-4.2.0.2/Data-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A HREF="#t%3ACoercionI" >CoercionI</A > </TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" >= <A HREF="#v%3AIdCo" >IdCo</A ></TD ></TR ><TR ><TD CLASS="decl" >| <A HREF="#v%3AACo" >ACo</A > <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisIdentityCoI" >isIdentityCoI</A > :: <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="../base-4.2.0.2/Data-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkSymCoI" >mkSymCoI</A > :: <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkTransCoI" >mkTransCoI</A > :: <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkTyConAppCoI" >mkTyConAppCoI</A > :: <A HREF="TyCon.html#t%3ATyCon" >TyCon</A > -> [<A HREF="Type.html#t%3AType" >Type</A >] -> [<A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A >] -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkAppTyCoI" >mkAppTyCoI</A > :: <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkFunTyCoI" >mkFunTyCoI</A > :: <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkForAllTyCoI" >mkForAllTyCoI</A > :: <A HREF="Var.html#t%3ATyVar" >TyVar</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AfromCoI" >fromCoI</A > :: <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="Type.html#t%3AType" >Type</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AfromACo" >fromACo</A > :: <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkClassPPredCoI" >mkClassPPredCoI</A > :: <A HREF="Class.html#t%3AClass" >Class</A > -> [<A HREF="Type.html#t%3AType" >Type</A >] -> [<A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A >] -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkIParamPredCoI" >mkIParamPredCoI</A > :: <A HREF="BasicTypes.html#t%3AIPName" >IPName</A > <A HREF="Name.html#t%3AName" >Name</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkEqPredCoI" >mkEqPredCoI</A > :: <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="1" ><A NAME="1" >Main data type </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >type</SPAN > <A NAME="t:Coercion" ><A NAME="t%3ACoercion" ></A ></A ><B >Coercion</B > = <A HREF="Type.html#t%3AType" >Type</A ></TD ></TR ><TR ><TD CLASS="doc" >A <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > represents a <TT ><A HREF="Type.html#t%3AType" >Type</A ></TT > something should be coerced to. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkCoKind" ><A NAME="v%3AmkCoKind" ></A ></A ><B >mkCoKind</B > :: <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="Type.html#t%3AType" >Type</A > -> CoercionKind</TD ></TR ><TR ><TD CLASS="doc" >Makes a <TT >CoercionKind</TT > from two types: the types whose equality is proven by the relevant <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkReflCoKind" ><A NAME="v%3AmkReflCoKind" ></A ></A ><B >mkReflCoKind</B > :: <A HREF="Type.html#t%3AType" >Type</A > -> CoercionKind</TD ></TR ><TR ><TD CLASS="doc" >Create a reflexive <TT >CoercionKind</TT > that asserts that a type can be coerced to itself </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:splitCoercionKind_maybe" ><A NAME="v%3AsplitCoercionKind_maybe" ></A ></A ><B >splitCoercionKind_maybe</B > :: <A HREF="Type.html#t%3AKind" >Kind</A > -> <A HREF="../base-4.2.0.2/Data-Maybe.html#t%3AMaybe" >Maybe</A > (<A HREF="Type.html#t%3AType" >Type</A >, <A HREF="Type.html#t%3AType" >Type</A >)</TD ></TR ><TR ><TD CLASS="doc" >Take a <TT >CoercionKind</TT > apart into the two types it relates, if possible. See also <TT ><A HREF="Coercion.html#v%3AsplitCoercionKind" >splitCoercionKind</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:splitCoercionKind" ><A NAME="v%3AsplitCoercionKind" ></A ></A ><B >splitCoercionKind</B > :: CoercionKind -> (<A HREF="Type.html#t%3AType" >Type</A >, <A HREF="Type.html#t%3AType" >Type</A >)</TD ></TR ><TR ><TD CLASS="doc" >Take a <TT >CoercionKind</TT > apart into the two types it relates: see also <TT ><A HREF="Coercion.html#v%3AmkCoKind" >mkCoKind</A ></TT >. Panics if the argument is not a valid <TT >CoercionKind</TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:coercionKind" ><A NAME="v%3AcoercionKind" ></A ></A ><B >coercionKind</B > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> (<A HREF="Type.html#t%3AType" >Type</A >, <A HREF="Type.html#t%3AType" >Type</A >)</TD ></TR ><TR ><TD CLASS="doc" ><P >If it is the case that </P ><PRE > c :: (t1 ~ t2) </PRE ><P >i.e. the kind of <TT >c</TT > is a <TT >CoercionKind</TT > relating <TT >t1</TT > and <TT >t2</TT >, then <TT >coercionKind c = (t1, t2)</TT >. See also <TT ><A HREF="Coercion.html#v%3AcoercionKindPredTy" >coercionKindPredTy</A ></TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:coercionKinds" ><A NAME="v%3AcoercionKinds" ></A ></A ><B >coercionKinds</B > :: [<A HREF="Coercion.html#t%3ACoercion" >Coercion</A >] -> ([<A HREF="Type.html#t%3AType" >Type</A >], [<A HREF="Type.html#t%3AType" >Type</A >])</TD ></TR ><TR ><TD CLASS="doc" >Apply <TT ><A HREF="Coercion.html#v%3AcoercionKind" >coercionKind</A ></TT > to multiple <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT >s </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:coercionKindPredTy" ><A NAME="v%3AcoercionKindPredTy" ></A ></A ><B >coercionKindPredTy</B > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> CoercionKind</TD ></TR ><TR ><TD CLASS="doc" >Recover the <TT >CoercionKind</TT > corresponding to a particular Coerceion. See also <TT ><A HREF="Coercion.html#v%3AcoercionKind" >coercionKind</A ></TT > and <TT ><A HREF="Coercion.html#v%3AmkCoKind" >mkCoKind</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:isIdentityCoercion" ><A NAME="v%3AisIdentityCoercion" ></A ></A ><B >isIdentityCoercion</B > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="../base-4.2.0.2/Data-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="2" ><A NAME="2" >Equality predicates </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:isEqPred" ><A NAME="v%3AisEqPred" ></A ></A ><B >isEqPred</B > :: <A HREF="Type.html#t%3APredType" >PredType</A > -> <A HREF="../base-4.2.0.2/Data-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkEqPred" ><A NAME="v%3AmkEqPred" ></A ></A ><B >mkEqPred</B > :: (<A HREF="Type.html#t%3AType" >Type</A >, <A HREF="Type.html#t%3AType" >Type</A >) -> <A HREF="Type.html#t%3APredType" >PredType</A ></TD ></TR ><TR ><TD CLASS="doc" >Creates a type equality predicate </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:getEqPredTys" ><A NAME="v%3AgetEqPredTys" ></A ></A ><B >getEqPredTys</B > :: <A HREF="Type.html#t%3APredType" >PredType</A > -> (<A HREF="Type.html#t%3AType" >Type</A >, <A HREF="Type.html#t%3AType" >Type</A >)</TD ></TR ><TR ><TD CLASS="doc" >Splits apart a type equality predicate, if the supplied <TT ><A HREF="Type.html#t%3APredType" >PredType</A ></TT > is one. Panics otherwise </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:isEqPredTy" ><A NAME="v%3AisEqPredTy" ></A ></A ><B >isEqPredTy</B > :: <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="../base-4.2.0.2/Data-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="doc" >Tests whether a type is just a type equality predicate </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="3" ><A NAME="3" >Coercion transformations </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkCoercion" ><A NAME="v%3AmkCoercion" ></A ></A ><B >mkCoercion</B > :: <A HREF="TyCon.html#t%3ATyCon" >TyCon</A > -> [<A HREF="Type.html#t%3AType" >Type</A >] -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="doc" >Make a coercion from the specified coercion <TT ><A HREF="TyCon.html#t%3ATyCon" >TyCon</A ></TT > and the <TT ><A HREF="Type.html#t%3AType" >Type</A ></TT > arguments to that coercion. Try to use the <TT >mk*Coercion</TT > family of functions instead of using this function if possible </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkSymCoercion" ><A NAME="v%3AmkSymCoercion" ></A ></A ><B >mkSymCoercion</B > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="doc" ><P >Create a symmetric version of the given <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > that asserts equality between the same types but in the other <A HREF="direction.html" >direction</A >, so a kind of <TT >t1 ~ t2</TT > becomes the kind <TT >t2 ~ t1</TT >. </P ><P >This function attempts to simplify the generated <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > by removing redundant applications of <TT >sym</TT >. This is done by pushing this new <TT >sym</TT > down into the <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > and exploiting the fact that <TT >sym (sym co) = co</TT >. </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkTransCoercion" ><A NAME="v%3AmkTransCoercion" ></A ></A ><B >mkTransCoercion</B > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="doc" ><P >Create a new <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > by exploiting transitivity on the two given <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT >s. </P ><P >This function attempts to simplify the generated <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > by exploiting the fact that <TT >sym g trans g = id</TT >. </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkLeftCoercion" ><A NAME="v%3AmkLeftCoercion" ></A ></A ><B >mkLeftCoercion</B > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="doc" ><P >From an application <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > build a <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > that asserts the equality of the <A HREF="functions.html" >functions</A > on either side of the type equality. So if <TT >c</TT > has kind <TT >f x ~ g y</TT > then: </P ><PRE > mkLeftCoercion c :: f ~ g </PRE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkRightCoercion" ><A NAME="v%3AmkRightCoercion" ></A ></A ><B >mkRightCoercion</B > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="doc" ><P >From an application <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > build a <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > that asserts the equality of the <A HREF="arguments.html" >arguments</A > on either side of the type equality. So if <TT >c</TT > has kind <TT >f x ~ g y</TT > then: </P ><PRE > mkLeftCoercion c :: x ~ y </PRE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkRightCoercions" ><A NAME="v%3AmkRightCoercions" ></A ></A ><B >mkRightCoercions</B > :: <A HREF="../base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> [<A HREF="Coercion.html#t%3ACoercion" >Coercion</A >]</TD ></TR ><TR ><TD CLASS="doc" >As <TT ><A HREF="Coercion.html#v%3AmkRightCoercion" >mkRightCoercion</A ></TT >, but finds the <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT >s available on the right side of <TT >n</TT > nested application <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT >s, manufacturing new left or right cooercions as necessary if suffficiently many are not directly available. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkInstCoercion" ><A NAME="v%3AmkInstCoercion" ></A ></A ><B >mkInstCoercion</B > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="doc" >Instantiates a <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > with a <TT ><A HREF="Type.html#t%3AType" >Type</A ></TT > argument. If possible, it immediately performs the resulting beta-reduction, otherwise it creates a suspended instantiation. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkAppCoercion" ><A NAME="v%3AmkAppCoercion" ></A ></A ><B >mkAppCoercion</B > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="doc" >Apply a <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > to another <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT >, which is presumably a <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > constructor of some kind </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkTyConCoercion" ><A NAME="v%3AmkTyConCoercion" ></A ></A ><B >mkTyConCoercion</B > :: <A HREF="TyCon.html#t%3ATyCon" >TyCon</A > -> [<A HREF="Coercion.html#t%3ACoercion" >Coercion</A >] -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="doc" >Apply a type constructor to a list of coercions. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkFunCoercion" ><A NAME="v%3AmkFunCoercion" ></A ></A ><B >mkFunCoercion</B > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="doc" >Make a function <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > between two other <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT >s </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkForAllCoercion" ><A NAME="v%3AmkForAllCoercion" ></A ></A ><B >mkForAllCoercion</B > :: <A HREF="Var.html#t%3AVar" >Var</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="doc" >Make a <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > which binds a variable within an inner <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkInstsCoercion" ><A NAME="v%3AmkInstsCoercion" ></A ></A ><B >mkInstsCoercion</B > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> [<A HREF="Type.html#t%3AType" >Type</A >] -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="doc" >As <TT ><A HREF="Coercion.html#v%3AmkInstCoercion" >mkInstCoercion</A ></TT >, but instantiates the coercion with a number of type arguments, left-to-right </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkUnsafeCoercion" ><A NAME="v%3AmkUnsafeCoercion" ></A ></A ><B >mkUnsafeCoercion</B > :: <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="doc" >Manufacture a coercion from this air. Needless to say, this is not usually safe, but it is used when we know we are dealing with bottom, which is one case in which it is safe. This is also used implement the <TT >unsafeCoerce#</TT > primitive. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkNewTypeCoercion" ><A NAME="v%3AmkNewTypeCoercion" ></A ></A ><B >mkNewTypeCoercion</B > :: <A HREF="Name.html#t%3AName" >Name</A > -> <A HREF="TyCon.html#t%3ATyCon" >TyCon</A > -> [<A HREF="Var.html#t%3ATyVar" >TyVar</A >] -> <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="TyCon.html#t%3ATyCon" >TyCon</A ></TD ></TR ><TR ><TD CLASS="doc" >Create a coercion suitable for the given <TT ><A HREF="TyCon.html#t%3ATyCon" >TyCon</A ></TT >. The <TT ><A HREF="Name.html#t%3AName" >Name</A ></TT > should be that of a new coercion <TT ><A HREF="TyCon.html#t%3ATyCon" >TyCon</A ></TT >, the <TT ><A HREF="Var.html#t%3ATyVar" >TyVar</A ></TT >s the arguments expected by the <TT >newtype</TT > and the type the appropriate right hand side of the <TT >newtype</TT >, with the free variables a subset of those <TT ><A HREF="Var.html#t%3ATyVar" >TyVar</A ></TT >s. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkFamInstCoercion" ><A NAME="v%3AmkFamInstCoercion" ></A ></A ><B >mkFamInstCoercion</B ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="arg" >:: <A HREF="Name.html#t%3AName" >Name</A ></TD ><TD CLASS="rdoc" >Unique name for the coercion tycon </TD ></TR ><TR ><TD CLASS="arg" >-> [<A HREF="Var.html#t%3ATyVar" >TyVar</A >]</TD ><TD CLASS="rdoc" >Type parameters of the coercion (<TT >tvs</TT >) </TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="TyCon.html#t%3ATyCon" >TyCon</A ></TD ><TD CLASS="rdoc" >Family tycon (<TT >F</TT >) </TD ></TR ><TR ><TD CLASS="arg" >-> [<A HREF="Type.html#t%3AType" >Type</A >]</TD ><TD CLASS="rdoc" >Type instance (<TT >ts</TT >) </TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="TyCon.html#t%3ATyCon" >TyCon</A ></TD ><TD CLASS="rdoc" >Representation tycon (<TT >R</TT >) </TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="TyCon.html#t%3ATyCon" >TyCon</A ></TD ><TD CLASS="rdoc" >Coercion tycon (<TT >Co</TT >) </TD ></TR ><TR ><TD CLASS="ndoc" COLSPAN="2" >Create a coercion identifying a <TT >data</TT >, <TT >newtype</TT > or <TT >type</TT > representation type and its family instance. It has the form <TT >Co tvs :: F ts ~ R tvs</TT >, where <TT >Co</TT > is the coercion tycon built here, <TT >F</TT > the family tycon and <TT >R</TT > the (derived) representation tycon. </TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkAppsCoercion" ><A NAME="v%3AmkAppsCoercion" ></A ></A ><B >mkAppsCoercion</B > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> [<A HREF="Coercion.html#t%3ACoercion" >Coercion</A >] -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="doc" >Applies multiple <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT >s to another <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT >, from left to right. See also <TT ><A HREF="Coercion.html#v%3AmkAppCoercion" >mkAppCoercion</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:splitNewTypeRepCo_maybe" ><A NAME="v%3AsplitNewTypeRepCo_maybe" ></A ></A ><B >splitNewTypeRepCo_maybe</B > :: <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="../base-4.2.0.2/Data-Maybe.html#t%3AMaybe" >Maybe</A > (<A HREF="Type.html#t%3AType" >Type</A >, <A HREF="Coercion.html#t%3ACoercion" >Coercion</A >)</TD ></TR ><TR ><TD CLASS="doc" ><P >Sometimes we want to look through a <TT >newtype</TT > and get its associated coercion. This function only strips *one layer* of <TT >newtype</TT > off, so the caller will usually call itself recursively. Furthermore, this function should only be applied to types of kind <TT >*</TT >, hence the newtype is always saturated. If <TT >co : ty ~ ty'</TT > then: </P ><PRE > splitNewTypeRepCo_maybe ty = Just (ty', co) </PRE ><P >The function returns <TT >Nothing</TT > for non-<TT >newtypes</TT > or fully-transparent <TT >newtype</TT >s. </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:instNewTyCon_maybe" ><A NAME="v%3AinstNewTyCon_maybe" ></A ></A ><B >instNewTyCon_maybe</B > :: <A HREF="TyCon.html#t%3ATyCon" >TyCon</A > -> [<A HREF="Type.html#t%3AType" >Type</A >] -> <A HREF="../base-4.2.0.2/Data-Maybe.html#t%3AMaybe" >Maybe</A > (<A HREF="Type.html#t%3AType" >Type</A >, <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A >)</TD ></TR ><TR ><TD CLASS="doc" ><P >If <TT >co :: T ts ~ rep_ty</TT > then: </P ><PRE > instNewTyCon_maybe T ts = Just (rep_ty, co) </PRE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:decomposeCo" ><A NAME="v%3AdecomposeCo" ></A ></A ><B >decomposeCo</B > :: <A HREF="BasicTypes.html#t%3AArity" >Arity</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> [<A HREF="Coercion.html#t%3ACoercion" >Coercion</A >]</TD ></TR ><TR ><TD CLASS="doc" ><P >This breaks a <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > with <TT >CoercionKind</TT > <TT >T A B C ~ T D E F</TT > into a list of <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT >s of kinds <TT >A ~ D</TT >, <TT >B ~ E</TT > and <TT >E ~ F</TT >. Hence: </P ><PRE > decomposeCo 3 c = [right (left (left c)), right (left c), right c] </PRE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:unsafeCoercionTyCon" ><A NAME="v%3AunsafeCoercionTyCon" ></A ></A ><B >unsafeCoercionTyCon</B > :: <A HREF="TyCon.html#t%3ATyCon" >TyCon</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:symCoercionTyCon" ><A NAME="v%3AsymCoercionTyCon" ></A ></A ><B >symCoercionTyCon</B > :: <A HREF="TyCon.html#t%3ATyCon" >TyCon</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:transCoercionTyCon" ><A NAME="v%3AtransCoercionTyCon" ></A ></A ><B >transCoercionTyCon</B > :: <A HREF="TyCon.html#t%3ATyCon" >TyCon</A ></TD ></TR ><TR ><TD CLASS="doc" >Coercion type constructors: avoid using these directly and instead use the <TT >mk*Coercion</TT > and <TT >split*Coercion</TT > family of functions if possible. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:leftCoercionTyCon" ><A NAME="v%3AleftCoercionTyCon" ></A ></A ><B >leftCoercionTyCon</B > :: <A HREF="TyCon.html#t%3ATyCon" >TyCon</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:rightCoercionTyCon" ><A NAME="v%3ArightCoercionTyCon" ></A ></A ><B >rightCoercionTyCon</B > :: <A HREF="TyCon.html#t%3ATyCon" >TyCon</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:instCoercionTyCon" ><A NAME="v%3AinstCoercionTyCon" ></A ></A ><B >instCoercionTyCon</B > :: <A HREF="TyCon.html#t%3ATyCon" >TyCon</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="4" ><A NAME="4" >Comparison </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:coreEqCoercion" ><A NAME="v%3AcoreEqCoercion" ></A ></A ><B >coreEqCoercion</B > :: <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A > -> <A HREF="../base-4.2.0.2/Data-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="doc" >Determines syntactic equality of coercions </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="5" ><A NAME="5" >CoercionI </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A NAME="t:CoercionI" ><A NAME="t%3ACoercionI" ></A ></A ><B >CoercionI</B > </TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="ndoc" ><P ><TT ><A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TT > represents a <EM >lifted</EM > ordinary <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT >, in that it can represent either one of: </P ><P >1. A proper <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > </P ><P >2. The identity coercion </P ></TD ></TR ><TR ><TD CLASS="section4" >Constructors</TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="arg" ><A NAME="v:IdCo" ><A NAME="v%3AIdCo" ></A ></A ><B >IdCo</B ></TD ><TD CLASS="rdoc" ></TD ></TR ><TR ><TD CLASS="arg" ><A NAME="v:ACo" ><A NAME="v%3AACo" ></A ></A ><B >ACo</B > <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ><TD CLASS="rdoc" ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="section4" ><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:CoercionI')" ALT="show/hide" > Instances</TD ></TR ><TR ><TD CLASS="body" ><DIV ID="i:CoercionI" STYLE="display:block;" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="Outputable.html#t%3AOutputable" >Outputable</A > <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:isIdentityCoI" ><A NAME="v%3AisIdentityCoI" ></A ></A ><B >isIdentityCoI</B > :: <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="../base-4.2.0.2/Data-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkSymCoI" ><A NAME="v%3AmkSymCoI" ></A ></A ><B >mkSymCoI</B > :: <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TD ></TR ><TR ><TD CLASS="doc" >Smart constructor for <TT >sym</TT > on <TT ><A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TT >, see also <TT ><A HREF="Coercion.html#v%3AmkSymCoercion" >mkSymCoercion</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkTransCoI" ><A NAME="v%3AmkTransCoI" ></A ></A ><B >mkTransCoI</B > :: <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TD ></TR ><TR ><TD CLASS="doc" >Smart constructor for <TT >trans</TT > on <TT ><A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TT >, see also <TT ><A HREF="Coercion.html#v%3AmkTransCoercion" >mkTransCoercion</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkTyConAppCoI" ><A NAME="v%3AmkTyConAppCoI" ></A ></A ><B >mkTyConAppCoI</B > :: <A HREF="TyCon.html#t%3ATyCon" >TyCon</A > -> [<A HREF="Type.html#t%3AType" >Type</A >] -> [<A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A >] -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TD ></TR ><TR ><TD CLASS="doc" >Smart constructor for type constructor application on <TT ><A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TT >, see also <TT ><A HREF="Coercion.html#v%3AmkAppCoercion" >mkAppCoercion</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkAppTyCoI" ><A NAME="v%3AmkAppTyCoI" ></A ></A ><B >mkAppTyCoI</B > :: <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TD ></TR ><TR ><TD CLASS="doc" >Smart constructor for honest-to-god <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > application on <TT ><A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TT >, see also <TT ><A HREF="Coercion.html#v%3AmkAppCoercion" >mkAppCoercion</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkFunTyCoI" ><A NAME="v%3AmkFunTyCoI" ></A ></A ><B >mkFunTyCoI</B > :: <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TD ></TR ><TR ><TD CLASS="doc" >Smart constructor for function-<TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT >s on <TT ><A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TT >, see also <TT ><A HREF="Coercion.html#v%3AmkFunCoercion" >mkFunCoercion</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkForAllTyCoI" ><A NAME="v%3AmkForAllTyCoI" ></A ></A ><B >mkForAllTyCoI</B > :: <A HREF="Var.html#t%3ATyVar" >TyVar</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TD ></TR ><TR ><TD CLASS="doc" >Smart constructor for quantified <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT >s on <TT ><A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TT >, see also <TT ><A HREF="Coercion.html#v%3AmkForAllCoercion" >mkForAllCoercion</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:fromCoI" ><A NAME="v%3AfromCoI" ></A ></A ><B >fromCoI</B > :: <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="Type.html#t%3AType" >Type</A ></TD ></TR ><TR ><TD CLASS="doc" >Return either the <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > contained within the <TT ><A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TT > or the given <TT ><A HREF="Type.html#t%3AType" >Type</A ></TT > if the <TT ><A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TT > is the identity <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:fromACo" ><A NAME="v%3AfromACo" ></A ></A ><B >fromACo</B > :: <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TD ></TR ><TR ><TD CLASS="doc" >Extract a <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT > from a <TT ><A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TT > if it represents one. If it is the identity coercion, panic </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkClassPPredCoI" ><A NAME="v%3AmkClassPPredCoI" ></A ></A ><B >mkClassPPredCoI</B > :: <A HREF="Class.html#t%3AClass" >Class</A > -> [<A HREF="Type.html#t%3AType" >Type</A >] -> [<A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A >] -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TD ></TR ><TR ><TD CLASS="doc" ><P >Smart constructor for class <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT >s on <TT ><A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TT >. Satisfies: </P ><PRE > mkClassPPredCoI cls tys cois :: PredTy (cls tys) ~ PredTy (cls (tys `cast` cois)) </PRE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkIParamPredCoI" ><A NAME="v%3AmkIParamPredCoI" ></A ></A ><B >mkIParamPredCoI</B > :: <A HREF="BasicTypes.html#t%3AIPName" >IPName</A > <A HREF="Name.html#t%3AName" >Name</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TD ></TR ><TR ><TD CLASS="doc" >Smart constructor for implicit parameter <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT >s on <TT ><A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TT >. Similar to <TT ><A HREF="Coercion.html#v%3AmkClassPPredCoI" >mkClassPPredCoI</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkEqPredCoI" ><A NAME="v%3AmkEqPredCoI" ></A ></A ><B >mkEqPredCoI</B > :: <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Type.html#t%3AType" >Type</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A > -> <A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TD ></TR ><TR ><TD CLASS="doc" >Smart constructor for type equality <TT ><A HREF="Coercion.html#t%3ACoercion" >Coercion</A ></TT >s on <TT ><A HREF="Coercion.html#t%3ACoercionI" >CoercionI</A ></TT >. Similar to <TT ><A HREF="Coercion.html#v%3AmkClassPPredCoI" >mkClassPPredCoI</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="botbar" >Produced by <A HREF="http://www.haskell.org/haddock/" >Haddock</A > version 2.6.1</TD ></TR ></TABLE ></BODY ></HTML >