Simon Peyton-Jones simonpj at
Fri Feb 6 09:49:25 EST 2004

I'm sorry, but I still can't figure out your specification.  Given
| type SqlColumn a = String
| type TypedExpr a = String
then the identity function will convert one to the other.  And if they
are different types, then my original observation still applies: I
assume you aren't expecting just to replace all Ints by Floats, because
that can't be well typed.

To put it another way, you want to write a *generic* function; that is,
one that works on arguments of many types. So what is the type that you
want your function to have?  For generic programming you want one type,
like this
	gsize :: Data a => a -> Int
gsize takes a data structure a and returns its size.

You give the type of 'project' by giving several examples.  So maybe you
want a type class, rather than generic functions?

I'm confused anyway.


| -----Original Message-----
| From: glasgow-haskell-users-bounces at
| bounces at] On Behalf Of MR K P SCHUPKE
| Sent: 05 February 2004 16:01
| To: glasgow-haskell-users at; k.schupke at; Simon
| Subject: RE: Generics...
| > Presumably not "replace all Ints by Floats"
| I've thought about it some more, and I don't think its
| possible to do what I want using generics... Ideally I would like
| to achieve the following type transformation:
| type SqlColumn a = String
| type TypedExpr a = Int
| the function would map SqlColumns to TypedExpr... The actual code
| generates an integer from a sequence to "tag" each column, but for
| the sake of simplicity, the following types would be sufficient:
| type SqlColumn a = String
| type TypedExpr a = String
| So we take a tuple of any length and return exactly the same
| tuple, but with the types changed:
| project :: (SqlColumn a,SqlColumn b) -> (TypedExpr a,TypedExpr b)
| project :: (SqlColumn a,SqlColumn b,SqlColumn c) -> (TypedExpr
a,TypedExpr b,TypedExpr c)
| What do you think?
| 	Regards,
| 	Keean Schupke.
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users at

More information about the Glasgow-haskell-users mailing list