Re: gunfoldl

2005-02-18 Thread Ralf Laemmel
It is called "gunfold" rather than "gunfoldl" as you will see when you browse the Data.Generics.Basics. Also, your gunfold code looks like it will not work. Here is a simple example for Maybe: gunfold k z con = case constrIndex con of 1 -> z Nothing -- no children 2 -> k (z

Re: Restricted Types and Infinite Loops

2005-02-18 Thread Ralf Laemmel
Hi Simon (PJ), cc Simon (DF), I rather reckon we are facing a bug here. The attached minimalised Foo.hs shows the offending code pattern. With GHC 6.2 we get "*** Exception: <> With GHC 6.4 we get " (still waiting for the rest of the string) The scenario is about class/instance-head-level recursi

Re: Restricted Types and Infinite Loops

2005-02-17 Thread Ralf Laemmel
Hi Simon SD, cc Simon PJ, (Since the _evaluation_ does not terminate (rather than type checking), this seems to imply that evaluation-time dictionary construction does not terminate. Right?) Anyhow, do this change, and your code works. diff SDF.save SDF.hs 10c10 < class (Data (DictClassA a) b, Cl

Re: gfindtype type

2005-01-26 Thread Ralf Laemmel
the same type as the parent node. Ouch, answered your question before I really read it, i.e., before a first cup of coffee. Sorry. Regards, Stefan ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/

Re: -fallow-incoherent-instances

2004-11-30 Thread Ralf Laemmel
Hi, you do realise that "-fallow-incoherent-instances" is enabling a hell. What mostly happens is that the most general instance is chosen. Which explains the error here: Say the confusing instance is chosen (because it is generic) and hence the type checker tries to establish the Confuse constrain

Re: Extensible Serialization class with type classes

2004-08-26 Thread Ralf Laemmel
Simon David Foster wrote: I've been trying to put together a type-class based serialization (XML) for types in GHC. Essentially the serializer class takes the form ... The Third attempt was to use existential types to encapsulate a constrained polymorphic type and use Typeable + Generics to choo

Re: Modelling Java Interfaces with Existential data types

2004-06-07 Thread Ralf Laemmel
{-# OPTIONS -fglasgow-exts #-} {-# OPTIONS -fallow-overlapping-instances #-} {- Hi Mike, You might heterogeneous lists useful. http://www.cwi.nl/~ralf/HList/ See the treatment of your example below. Cheers, Ralf -} import HList import HTypeDriven -- These are your two "implementations". da

Re: What happened to constrFields?

2004-05-09 Thread Ralf Laemmel
The problem is that constrFields is not included with 6.2.1. You would need to build GHC from CVS. It will be in 6.4 for sure. And yes, you are right, there is no other way to get the names of all fields of a constructor. Ralf Stefan Reich wrote: In recent versions of the GHC libraries, constrFie

Re: Polymorphic lists...

2004-03-10 Thread Ralf Laemmel
MR K P SCHUPKE wrote: Hi Oleg, I like the polymorphic list indexed by Ints... there do seem to be a couple of differences between this and the list indexed by natural numbers. ... Agreed with these differences. Another difference: it is initially a heterogeneous set rather than list! (Becaus

Re: Polymorphic lists...

2004-03-09 Thread Ralf Laemmel
Hi Kean, looks cool. I get your point about static typing. I guess that adding a fold operator would make your implementation more complete. Oleg has also encountered some of your operations (as you probably know): http://www.haskell.org/pipermail/haskell/2003-August/012355.html (Oleg also prefe

Re: Polymorphic lists...

2004-03-08 Thread Ralf Laemmel
I would like to see your code indeed ... it seems the attachment was missing. Anyway, I am not sure if it obvious or not, but heterogenously typed lists can be nicely modelled with Data.Typeable (!!!) I guess we should add something like this to the module? See http://www.cs.vu.nl/boilerplate/tests