RE: missing Data instances

2005-12-29 Thread Ralf Lammel
Simon PJ,

Is that Ok?
Should I?

Ralf

> -Original Message-
> From: [EMAIL PROTECTED]
[mailto:glasgow-haskell-
> [EMAIL PROTECTED] On Behalf Of Frederik Eaton
> Sent: Thursday, December 29, 2005 11:39 AM
> To: glasgow-haskell-bugs@haskell.org
> Subject: missing Data instances
> 
> These don't seem to have Data instances in 6.4.1:
> 
> Language.Haskell.TH.Exp
> Data.Tree.Tree
> 
> I guess there are probably a lot more, I just ran into these today. Is
> there anything which prevents proper 'deriving' clauses from being
> added to their definitions?
> 
> Frederik
> ___
> Glasgow-haskell-bugs mailing list
> Glasgow-haskell-bugs@haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


missing Data instances

2005-12-29 Thread Frederik Eaton
These don't seem to have Data instances in 6.4.1:

Language.Haskell.TH.Exp
Data.Tree.Tree

I guess there are probably a lot more, I just ran into these today. Is
there anything which prevents proper 'deriving' clauses from being
added to their definitions?

Frederik
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: Constr and Eq

2005-12-29 Thread Frederik Eaton
I see. Maybe there should be a separate function

efficientConstrEq :: Constr -> Constr -> Bool

so that people don't get confused with the standard Eq definition? How
often is the efficient version needed?

In any case, it seems like we should document the fact that the Constr
Eq instance doesn't work in the usual way.

Frederik

On Thu, Dec 29, 2005 at 11:23:15AM -0800, Ralf Lammel wrote:
> As of today, this is done so to be efficient.
> You can easily compare the data types of the constructors to further
> constrain equivalence, when this is necessary, while the base check only
> compares an Integer value for the constructors.
> Ralf
> 
> 
> > -Original Message-
> > From: [EMAIL PROTECTED]
> [mailto:glasgow-haskell-
> > [EMAIL PROTECTED] On Behalf Of Frederik Eaton
> > Sent: Thursday, December 29, 2005 10:57 AM
> > To: glasgow-haskell-bugs@haskell.org
> > Subject: Constr and Eq
> > 
> > > toConstr True
> > True
> > > toConstr [()]
> > (:)
> > > toConstr True == toConstr [()]
> > True
> > > show (toConstr True) == show (toConstr [()])
> > False
> > 
> > I don't understand the utility of Constr's Eq definition. It isn't
> > really documented though. Why return True when the constructors being
> > compared are different? Am I supposed to use (show.toConstr) to
> > compare constructors?
> > 
> > Here is the documentation I could find:
> > 
> > data Constr
> > Representation of constructors
> > Instances
> > Show Constr
> > Eq Constr
> > 
> > This is ghc 6.4.1.
> > 
> > Thanks,
> > 
> > Frederik
> > ___
> > Glasgow-haskell-bugs mailing list
> > Glasgow-haskell-bugs@haskell.org
> > http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
> 
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


RE: Constr and Eq

2005-12-29 Thread Ralf Lammel
As of today, this is done so to be efficient.
You can easily compare the data types of the constructors to further
constrain equivalence, when this is necessary, while the base check only
compares an Integer value for the constructors.
Ralf


> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:glasgow-haskell- [EMAIL PROTECTED] On Behalf Of 
> Frederik Eaton
> Sent: Thursday, December 29, 2005 10:57 AM
> To: glasgow-haskell-bugs@haskell.org
> Subject: Constr and Eq
> 
> > toConstr True
> True
> > toConstr [()]
> (:)
> > toConstr True == toConstr [()]
> True
> > show (toConstr True) == show (toConstr [()])
> False
> 
> I don't understand the utility of Constr's Eq definition. It isn't 
> really documented though. Why return True when the constructors being 
> compared are different? Am I supposed to use (show.toConstr) to 
> compare constructors?
> 
> Here is the documentation I could find:
> 
> data Constr
> Representation of constructors
> Instances
> Show Constr
> Eq Constr
> 
> This is ghc 6.4.1.
> 
> Thanks,
> 
> Frederik
> ___
> Glasgow-haskell-bugs mailing list
> Glasgow-haskell-bugs@haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Constr and Eq

2005-12-29 Thread Frederik Eaton
> toConstr True
True
> toConstr [()]
(:)
> toConstr True == toConstr [()]
True
> show (toConstr True) == show (toConstr [()])
False

I don't understand the utility of Constr's Eq definition. It isn't
really documented though. Why return True when the constructors being
compared are different? Am I supposed to use (show.toConstr) to
compare constructors?

Here is the documentation I could find:

data Constr
Representation of constructors
Instances
Show Constr
Eq Constr

This is ghc 6.4.1.

Thanks,

Frederik
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


RE: GADTs and type synonyms

2005-12-29 Thread Simon Peyton-Jones
Hmm.  There's a question here.  Constructor args allow you to put
strictness annotations

  data Foo where
MkFoo :: !Int -> !Bool -> Foo

You want to hide part of the declaration inside a type signature.   But
then what about the strictness annotations?   I suppose you could argue
for

  type Baz = !Bool -> Foo
  data Foo where
 MkFoo :: !Int -> Baz

But that's a new kind of 'type' declaration.  Maybe you could argue that
you should be allowed to use a type synonym when you don't need
strictness annotations, but that seems a bit of a hack.

So GHC currently insists that you write all the argument types of the
constructor, and the result, explicitly, with no type synonyms in the
way.  Do you think that's bad?  

The error message could be better I suppose.

Simon  

| -Original Message-
| From: [EMAIL PROTECTED]
[mailto:glasgow-haskell-bugs-
| [EMAIL PROTECTED] On Behalf Of Ralf Hinze
| Sent: 28 December 2005 07:11
| To: glasgow-haskell-bugs@haskell.org
| Subject: GADTs and type synonyms
| 
| Another GADT `bug report': type synonyms are not unfolded
| when checking the signature of the data constructors: given
| 
| > type Hello a = a -> a
| > data World :: * where
| >   Msg :: Hello World
| 
| GHC reports
| 
| GADT.lhs:2:1:
| Data constructor `Msg' returns type `Hello'
|   instead of its parent type
| When checking the data constructor: Msg
| In the data type declaration for `World'
| 
| Applies to both version 6.4.1 and 6.5.
| 
| Cheers, Ralf
| ___
| Glasgow-haskell-bugs mailing list
| Glasgow-haskell-bugs@haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs