Re: type signatures with existentially quantified data constructors

2001-08-16 Thread Dylan Thurston
On Thu, Aug 16, 2001 at 01:11:25AM -0400, Avi Pfeffer wrote: > Works fine. Things get tricky when I try to add pairs. In order to type > a pair expression, I find I need to create a Pair class and introduce a > class constraint: > > class Pair a b c | a -> b c, b c -> a > > instance Pair (b,c

Re: type signatures with existentially quantified data constructors

2001-08-15 Thread Levent Erkok
How about: === data Expr a = Haskell a | If (Expr Bool) (Expr a) (Expr a) | forall b . Appl (Expr (b->a)) (Expr b) | forall b c . MkPair (Expr b) (Expr c) (b -> c -> a) eval :: Expr a -> a eval (

type signatures with existentially quantified data constructors

2001-08-15 Thread Avi Pfeffer
Hi all, I'm trying to write an interpreter for a language embedded in Haskell, that "inherits" Haskell types and values. So I create a type Expr a, to represent expressions of type a, and an evaluator that takes an Expr a and produces an a. (To keep things simple, let's assume there are no vari

RE: Type signatures in instance declarations?

2000-04-11 Thread Peter Hancock
Hi Simon, >>>>> "Simon" == Simon Peyton-Jones <[EMAIL PROTECTED]> writes: > | Subject: Type signatures in instance declarations? > .. > | I think it would be even useful to the compiler when one has a > | polymorphic recursion.

RE: Type signatures in instance declarations?

2000-04-11 Thread Simon Peyton-Jones
| Subject: Type signatures in instance declarations? | | > Why are these illegal? I appreciate that they can't | give useful information | > to the compiler, which knows the type already from the | class, but in my | > opinion they are still useful to the maintain

Re: Type signatures in instance declarations?

2000-04-10 Thread Marc van Dongen
: comments). I would love to see type signatures in export lists. It may also allow you to export a function implemented with a universal type signature for a certain specific type. > module Foo( same :: Int -> Int -> Bool ) where > same :: a -> a -> Bool > same = (==) Regards, Marc

Re: Type signatures in instance declarations?

2000-04-10 Thread Koen Claessen
Some people write: | "Type signatures in instance declarations?" | Why are these illegal? I agree completely. Related questions are: * Why can one not have a type declaration of a function twice ore more in a file? It seems a bit silly, because you are allowed to pu

Type signatures in instance declarations?

2000-04-10 Thread Peter Hancock
George Russell <[EMAIL PROTECTED]> writes: > Why are these illegal? I appreciate that they can't give useful information > to the compiler, which knows the type already from the class, but in my > opinion they are still useful to the maintainer, because they serve as > a reminder

Re: Type signatures in instance declarations?

2000-04-10 Thread Marc van Dongen
George Russell ([EMAIL PROTECTED]) wrote: : Why are these illegal? I appreciate that they can't give useful information : to the compiler, which knows the type already from the class, but in my : opinion they are still useful to the maintainer, because they serve as : a reminder of the type. :

Type signatures in instance declarations?

2000-04-10 Thread George Russell
Why are these illegal? I appreciate that they can't give useful information to the compiler, which knows the type already from the class, but in my opinion they are still useful to the maintainer, because they serve as a reminder of the type.

RE: Type signatures in Haskell 98

1999-05-07 Thread Simon Peyton-Jones
> > Here's a good Haskell 98 question: is this a valid H98 module? > > > > module F where > > sin :: Float -> Float > > sin x = (x::Float) > > > > f :: Float -> Float > > f x = Prelude.sin (F.sin x) > > > That sounds like a fine thing to do if

Re: Type signatures in Haskell 98

1999-05-06 Thread Fergus Henderson
it in the H98 report. And the same applies to > fixity declarations. > > I propose to treat it as a typo, and add a clarifying remark > to Section 5.5.2 (name clashes) that makes it clear that type signatures > and fixity declarations are always unqualified, and refer (of course) >

Type signatures in Haskell 98

1999-04-28 Thread Simon Peyton-Jones
ere, so presumably there is only one 'sin' that can possibly be meant by this signature, namely F.sin. But this isn't explicit in the H98 report. And the same applies to fixity declarations. I propose to treat it as a typo, and add a clarifying remark to Section 5.5.2 (name clashes) th

Type signatures

1993-10-05 Thread Simon L Peyton Jones
Folks, Warren Burton makes what appears to me to be a Jolly Sensible suggestion about the syntax of type signatures. Haskell already has many dual ways of doing things (let/where, case/pattern-matching). Warren proposes an alternative syntax for type signatures. Simon --- Forwarded