-- | Reimplementation of Dynamic that supports dynBind---- We don't have access to the internal representation of Dynamic, otherwise-- we would not have to redefine it completely. Note that we use this only-- internally, so the incompatibility with "our" Dynamic from the standard -- Dynamic is not important.{-# LANGUAGE MagicHash #-}moduleControl.Distributed.Process.Internal.Dynamic(Dynamic(..),toDyn,fromDyn,fromDynamic,dynTypeRep,dynApply,dynApp,GHC.unsafeCoerce#)whereimportData.Typeable(Typeable,TypeRep,typeOf,funResultTy)importqualifiedGHC.PrimasGHC(Any,unsafeCoerce#)importData.Maybe(fromMaybe)dataDynamic=DynamicTypeRepGHC.AnytoDyn::Typeablea=>a->DynamictoDynx=Dynamic(typeOfx)(GHC.unsafeCoerce#x)fromDyn::Typeablea=>Dynamic->a->afromDyn(Dynamicrepval)a=ifrep==typeOfathenGHC.unsafeCoerce#valelseafromDynamic::foralla.Typeablea=>Dynamic->MaybeafromDynamic(Dynamicrepval)=ifrep==typeOf(undefined::a)thenJust(GHC.unsafeCoerce#val)elseNothingdynTypeRep::Dynamic->TypeRepdynTypeRep(Dynamict_)=tinstanceShowDynamicwhereshow=show.dynTypeRepdynApply::Dynamic->Dynamic->MaybeDynamicdynApply(Dynamict1f)(Dynamict2x)=casefunResultTyt1t2ofJustt3->Just(Dynamict3(GHC.unsafeCoerce#fx))Nothing->NothingdynApp::Dynamic->Dynamic->DynamicdynAppfx=fromMaybe(errortypeError)(dynApplyfx)wheretypeError="Type error in dynamic application.\n"++"Can't apply function "++showf++" to argument "++showx