From 6527d4cd1c1560e23e2776f50f1c8cda2385e566 Mon Sep 17 00:00:00 2001 From: sof Date: Mon, 3 Aug 1998 23:12:49 +0000 Subject: [PATCH] [project @ 1998-08-03 23:12:49 by sof] Added sect. on Dynamic library --- ghc/docs/libraries/libs.sgml | 155 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 146 insertions(+), 9 deletions(-) diff --git a/ghc/docs/libraries/libs.sgml b/ghc/docs/libraries/libs.sgml index 1b1a4a0..3de5911 100644 --- a/ghc/docs/libraries/libs.sgml +++ b/ghc/docs/libraries/libs.sgml @@ -60,15 +60,6 @@ the form - - -This library provides support for both . In addition to the -monad

@@ -159,6 +150,8 @@ space leaks than the strict version, so most programmers will use the former unless laziness is explicitly required. + lazyToStrictST :: LazyST.ST s a -> ST.ST s a strictToLazyST :: ST.ST s a -> LazyST.ST s a @@ -708,6 +701,150 @@ which might be used to build an ordered binary tree, say. + +

+ +The +data Dynamic -- abstract, instance of: Show -- + +toDyn :: Typeable a => a -> Dynamic +fromDyn :: Typeable a => Dynamic -> a -> a +fromDynamic :: Typeable a => Dynamic -> Maybe a + + + + There's two ways of going from a dynamic value to one with +a concrete type: + + +

+ +Haskell types are represented as terms using the +data TypeRep -- abstract, instance of: Eq, Show +data TyCon -- abstract, instance of: Eq, Show + +mkTyCon :: String -> TyCon +mkAppTy :: TyCon -> [TypeRep] -> TypeRep +mkFunTy :: TypeRep -> TypeRep -> TypeRep +applyTy :: TypeRep -> TypeRep -> Maybe TypeRep + + + + Type constructors are represented by the abstract type, + +Most importantly, +To allow comparisons between +mkTyCon :: String -> TyCon + + +An implementation of the + mkTyCon "a" == mkTyCon "a" + + +A really efficient implementation is possible if we guarantee/demand +that the strings are unique, and for a particular type constructor, +the application Would this constraint be +unworkable in practice?] + +Both + + +

+ +To ease the construction of +class Typeable a where + typeOf :: a -> TypeRep + + + + The The + + +

+ +Operations for applying a dynamic function type to a +dynamically typed argument are commonly useful, and +also provided: + + +dynApply :: Dynamic -> Dynamic -> Dynamic -- unsafe. +dynApplyMb :: Dynamic -> Dynamic -> Maybe Dynamic + + + +

-- 1.7.10.4