> The analogous declaration in *Standard* ML, which gets this right, is
>
> fun 'a foo (x:'a) y = (x + 1, (y:'a))
Following up my own post, I thought it might be kind to explain the
arcana of the SML syntax. The explicit 'a between 'fun' and 'foo' is
SML syntax for an explicit type-lambda (
> Regarding the quantification: in ML (OCaml) we can write
> let foo (x:'a) y = (x+1,(y:'a))
> That does not mean that foo has the type forall 'a. 'a -> 'a -> ...
Type annotations in OCaml are completely broken and always have been.
They use 'unifies with' instead of 'is an instance of' an
[EMAIL PROTECTED] wrote:
>
> I'm afraid I may disagree about the quantification. Also, I'm cautious
> about the phrase "ML and Haskell". In GHC 6.4, local type variables
> behave pretty much like those in ML (actually, GHC 6.2 was closer). In
> GHC 6.6, the behavior is completely different!
>
> Reg
> > Or, one may use the local type variable to the same end
> >
> > > compile1 :: forall b t box. (Builder b box) => t -> Name -> Ir.ANF -> b
> > > t compile1 f x body = do env <- compile body empty
> > > wire ((Arg W)::Source box) (env x)
> > >
> Norman Ramsey wrote:
>
> > compile1 :: (Builder b box) => t -> Name -> Ir.ANF -> b t
> > compile1 f x body = do env <- compile body empty
> > wire (Arg W) (env x)
> > return f
> > class (Monad b) => Builder b box where
> > wire
Norman Ramsey wrote:
> compile1 :: (Builder b box) => t -> Name -> Ir.ANF -> b t
> compile1 f x body = do env <- compile body empty
> wire (Arg W) (env x)
> return f
> class (Monad b) => Builder b box where
> wire:: Source bo