Polymorphic lists...
MR K P SCHUPKE
k.schupke at imperial.ac.uk
Mon Mar 8 17:12:05 EST 2004
I needed a list which could handle items of different types for the
database code I am writing. I have written a module implementing such a
list based on dependant types (from Conor McBride: Faking It; Simulating
Depandant Types in Haskell). Although McBride does not mention
lists/vectors with items of differing types, the solution to
implementing them came from his 'nthFront' function for re-arranging the
order of arguments to a function.
Any type can be inserted into the list, which supports
head/tail/init/last, as well as indexed lookup, and a cartesian-product
(concatenating two lists together). I have included fromTuple/toTuple as
well.
This seems quite a useful construct, and if there is nothing similar in
the standard libraries at the moment, do you think this is worth including?
Regards,
Keean Schupke.
More information about the Glasgow-haskell-users
mailing list