HaskellWiki

Haskell | Wiki community | Recent changes
Random page | Special pages

 

Not logged in
Log in | Help

Applications and libraries/Generic programming/Lightweight

< Applications and libraries | Generic programming

Contents

1 Approach: A Lightweight Implementation of Generics and Dynamics

2 Required features/Portability

3 Expressibility

4 Subset of data types covered

5 Usage

6 Error Messages

7 Amount of work per data type (Boilerplate)

8 Extensibility

9 Reasoning

TODO

10 Performance considerations

11 Helpful extra features

12 Discussion

(Bruno Oliveira)

An interesting approach which is quite lightweight and that is fairly easy to use (specially if we would not need to handle any of the boilerplate). It is a bit outdated because with GADTs, the use can be slightly simplified. However, this also takes us further away from Haskell 98 or even Haskell' (since GADTs will not be there). I think that LIGD is still a reference for a generic programming library that uses a data type for type representations and sums of products as a family of data types.

A drawback may be performance, since we need to convert a data type into its isomorphic sum of products representation.

(James Cheney)

From what I've seen, Ralf's "Fun with phantom types", "generics for the masses" and from what I've heard Stephanie's RepLib (caveat: haven't read that paper carefully) are in a similar spirit and subsume much or all of what's in the LIGD paper. Also, much more now appears to be known about complementary things like GADTs, open/extensible types and functions which could help fix some of the limitations of the original LIGD approach.

Assuming that GADTs do eventually become a standard feature, I'd definitely be in favor of using them instead of explicit to/from conversions in an implementation of LIGD, for efficiency if nothing else. In addition, as the FCPT paper notes, there are some natural seeming things that you can only do if equations are known to the type system. This was one motivation for our subsequent tech report on "first class phantom types", which essentially proposed extending Haskell 98 with equation guards on datatypes, i.e. GADTs. But, once you have GADTs a lot of things appear to get simpler, and simulating first-class generics/dynamics via type representations seem to be just one example.

(Johan Jeuring)

I think LIGD is quite a nice library, that needs almost no Haskell extensions. But it has its limitations.

Retrieved from "http://www.haskell.org/haskellwiki/Applications_and_libraries/Generic_programming/Lightweight"

This page has been accessed 330 times. This page was last modified 12:51, 11 May 2007. Recent content is available under a simple permissive license.