X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=docs%2Fusers_guide%2Fglasgow_exts.xml;h=b1e9c3127296a53b15563143520271b46c4a3688;hb=a975e8341a53ec9cef25af816a9bf9ce96c16391;hp=7e78c7299c9a69de6afc5bc800e1e6bd85711f93;hpb=6a05ec5ef5373f61b7f9f5bdc344483417fa801b;p=ghc-hetmet.git diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml index 7e78c72..b1e9c31 100644 --- a/docs/users_guide/glasgow_exts.xml +++ b/docs/users_guide/glasgow_exts.xml @@ -1744,11 +1744,6 @@ dictionaries for Eq and Show respectively, extract it on pattern matching. - -Notice the way that the syntax fits smoothly with that used for -universal quantification earlier. - - @@ -2021,9 +2016,9 @@ In the example, the equality dictionary is used to satisfy the equality constrai generated by the call to elem, so that the type of insert itself has no Eq constraint. -This behaviour contrasts with Haskell 98's peculiar treament of +This behaviour contrasts with Haskell 98's peculiar treatment of contexts on a data type declaration (Section 4.2.1 of the Haskell 98 Report). -In Haskell 98 the defintion +In Haskell 98 the definition data Eq a => Set' a = MkSet' [a] @@ -2132,7 +2127,7 @@ field f must be the same (modulo alpha conversion). At the moment, record updates are not yet possible with GADT-style declarations, so support is limited to record construction, selection and pattern matching. -For exmaple +For example aPerson = Adult { name = "Fred", children = [] } @@ -2239,7 +2234,7 @@ constructor). You cannot use a deriving clause for a GADT; only for -an ordianary data type. +an ordinary data type. @@ -2307,7 +2302,7 @@ The third is not Haskell 98, and risks losing termination of instances. GHC takes a conservative position: it accepts the first two, but not the third. The rule is this: each constraint in the inferred instance context must consist only of type variables, -with no repititions. +with no repetitions. This rule is applied regardless of flags. If you want a more exotic context, you can write @@ -2343,7 +2338,7 @@ For example: deriving instance MonadState Int Foo GHC always treats the last parameter of the instance -(Foo in this exmample) as the type whose instance is being derived. +(Foo in this example) as the type whose instance is being derived. @@ -3259,7 +3254,7 @@ by which time more is known about the type b. The willingness to be overlapped or incoherent is a property of the instance declaration itself, controlled by the presence or otherwise of the -and flags when that mdodule is +and flags when that module is being defined. Neither flag is required in a module that imports and uses the instance declaration. Specifically, during the lookup process: @@ -3372,7 +3367,7 @@ instance IsString [Char] where fromString cs = cs The class IsString is not in scope by default. If you want to mention -it explicitly (for exmaple, to give an instance declaration for it), you can import it +it explicitly (for example, to give an instance declaration for it), you can import it from module GHC.Exts. @@ -3553,7 +3548,7 @@ J Lewis, MB Shields, E Meijer, J Launchbury, Boston, Jan 2000. -(Most of the following, stil rather incomplete, documentation is +(Most of the following, still rather incomplete, documentation is due to Jeff Lewis.) Implicit parameter support is enabled with the option @@ -3733,7 +3728,7 @@ In the former case, len_acc1 is monomorphic in its own right-hand side, so the implicit parameter ?acc is not passed to the recursive call. In the latter case, because len_acc2 has a type signature, the recursive call is made to the -polymoprhic version, which takes ?acc +polymorphic version, which takes ?acc as an implicit parameter. So we get the following results in GHCi: Prog> len1 "hello" @@ -3858,7 +3853,7 @@ Other points: '?x' and '%x' are entirely distinct implicit parameters: you - can use them together and they won't intefere with each other. + can use them together and they won't interfere with each other. You can bind linear implicit parameters in 'with' clauses. @@ -4371,7 +4366,7 @@ a type. (This is a change from GHC's earlier design.) Furthermore, distinct lexical type variables stand for distinct type variables. This means that every programmer-written type signature -(includin one that contains free scoped type variables) denotes a +(including one that contains free scoped type variables) denotes a rigid type; that is, the type is fully known to the type checker, and no inference is involved. Lexical type variables may be alpha-renamed freely, without @@ -4388,7 +4383,7 @@ A lexically scoped type variable can be bound by: -In Haskell, a programmer-written type signature is implicitly quantifed over +In Haskell, a programmer-written type signature is implicitly quantified over its free type variables (Section 4.1.2 @@ -4463,7 +4458,7 @@ For example: g (x::a) = x h ((x,y) :: (Int,Bool)) = (y,x) -In the case where all the type variables in the pattern type sigature are +In the case where all the type variables in the pattern type signature are already in scope (i.e. bound by the enclosing context), matters are simple: the signature simply constrains the type of the pattern in the obvious way. @@ -4489,7 +4484,7 @@ existentially-bound type variable. If this seems a little odd, we think so too. But we must have some way to bring such type variables into scope, else we -could not name existentially-bound type variables in subequent type signatures. +could not name existentially-bound type variables in subsequent type signatures. This is (now) the only situation in which a pattern type @@ -4614,12 +4609,12 @@ This is rejected by Haskell 98, but under Jones's scheme the definition for g is typechecked first, separately from that for f, because the reference to f in g's right -hand side is ingored by the dependency analysis. Then g's +hand side is ignored by the dependency analysis. Then g's type is generalised, to get g :: Ord a => a -> Bool -Now, the defintion for f is typechecked, with this type for +Now, the definition for f is typechecked, with this type for g in the type environment. @@ -4910,7 +4905,7 @@ The basic idea is to compile the program twice: Then compile it again with , and additionally use - to name the object files differentliy (you can choose any suffix + to name the object files differently (you can choose any suffix that isn't the normal object suffix here). GHC will automatically load the object files built in the first step when executing splice expressions. If you omit the flag when @@ -5468,7 +5463,7 @@ g6 x = case f x of { y -> body } g7 x = case f x of { !y -> body } The functions g5 and g6 mean exactly the same thing. -But g7 evalutes (f x), binds y to the +But g7 evaluates (f x), binds y to the result, and then evaluates body. Bang patterns work in let and where @@ -5781,7 +5776,7 @@ Assertion failures can be caught, see the documentation for the When you compile any module that imports and uses any of the specified entities, GHC will print the specified message. - You can only depecate entities declared at top level in the module + You can only deprecate entities declared at top level in the module being compiled, and you can only use unqualified names in the list of entities being deprecated. A capitalised name, such as T refers to either the type constructor T @@ -6013,7 +6008,7 @@ happen. {-# SPECIALIZE f :: <type> #-} - is valid if and only if the defintion + is valid if and only if the definition f_spec :: <type> f_spec = f @@ -6038,7 +6033,7 @@ well. If you use this kind of specialisation, let us know how well it works. A SPECIALIZE pragma can optionally be followed with a INLINE or NOINLINE pragma, optionally followed by a phase, as described in . -The INLINE pragma affects the specialised verison of the +The INLINE pragma affects the specialised version of the function (only), and applies even if the function is recursive. The motivating example is this: @@ -6734,7 +6729,7 @@ If you add you get a more detailed listing. - The definition of (say) build in GHC/Base.lhs looks llike this: + The definition of (say) build in GHC/Base.lhs looks like this: build :: forall a. (forall b. (a -> b -> b) -> b -> b) -> [a] @@ -6831,7 +6826,7 @@ r) -> Special built-in functions -GHC has a few built-in funcions with special behaviour. These +GHC has a few built-in functions with special behaviour. These are now described in the module GHC.Prim in the library documentation. @@ -7001,7 +6996,7 @@ So this too is illegal: op2 :: a -> Bool op2 {| p :*: q |} (x :*: y) = False -(The reason for this restriction is that we gather all the equations for a particular type consructor +(The reason for this restriction is that we gather all the equations for a particular type constructor into a single generic instance declaration.) @@ -7032,7 +7027,7 @@ Here, op1, op2, op3 are OK, but op4 is rejected, because it has a type variable inside a list. -This restriction is an implementation restriction: we just havn't got around to +This restriction is an implementation restriction: we just haven't got around to implementing the necessary bidirectional maps over arbitrary type constructors. It would be relatively easy to add specific type constructors, such as Maybe and list, to the ones that are allowed.