Difference between revisions of "Generalised algebraic datatype"

From HaskellWiki
Jump to navigation Jump to search
m (Sorry -- of course I meant ,,Generalised algebraic datatype'')
m (typographic corrections)
Line 5: Line 5:
   
 
= Example =
 
= Example =
An example: it seems to me that generalised abstract datatypes can provide a nice solution to a problem described in Daan Leijen and Erik Meijer's [http://www.haskell.org/haskellDB/doc.html paper] (see PostScript version) on the [http://www.haskell.org/haskellDB/ original HaskellDB] page: making typeful (safe) representation of terms of another language (here: SQL). In this example, the problem has been solved in a funny way with [[Phantom type]] (we destroy and rebuild, a nice topic for a myth or scifi where a dreamworld is simulated on top of a previously homogenized world to look like the original?), but solving the problem with GADTs seems to be a more direct way (maybe that's why [http://research.microsoft.com/Users/simonpj/papers/gadt/index.htm Simple unification-based type inference for GADTs] mentions that they are also called as ''first-class phantom types''?)
+
An example: it seems to me that generalised algebraic datatypes can provide a nice solution to a problem described in Daan Leijen and Erik Meijer's [http://www.haskell.org/haskellDB/doc.html paper] (see PostScript version) on the [http://www.haskell.org/haskellDB/ original HaskellDB] page: making typeful (safe) representation of terms of another language (here: SQL). In this example, the problem has been solved in a funny way with [[Phantom type]] (we destroy and rebuild, a nice topic for a myth or scifi where a dreamworld is simulated on top of a previously homogenized world to look like the original?), but solving the problem with GADTs seems to be a more direct way (maybe that's why [http://research.microsoft.com/Users/simonpj/papers/gadt/index.htm Simple unification-based type inference for GADTs] mentions that they are also called as ''first-class phantom types''?)
   
 
= Related concepts =
 
= Related concepts =

Revision as of 01:17, 26 March 2006

General

Example

An example: it seems to me that generalised algebraic datatypes can provide a nice solution to a problem described in Daan Leijen and Erik Meijer's paper (see PostScript version) on the original HaskellDB page: making typeful (safe) representation of terms of another language (here: SQL). In this example, the problem has been solved in a funny way with Phantom type (we destroy and rebuild, a nice topic for a myth or scifi where a dreamworld is simulated on top of a previously homogenized world to look like the original?), but solving the problem with GADTs seems to be a more direct way (maybe that's why Simple unification-based type inference for GADTs mentions that they are also called as first-class phantom types?)

Related concepts

There are other developed tricks with types in Type, and another way to a more general framework in Dependent types. The fully dependently typed langage's Epigram tutorial (section 6.1) mentions Haskells GADTs and Epigram's relatedness to Haskell achieved by them.

The more general problem (representing the terms of a language with the terms of another language) can develop surprising things, e.g. quines (self-replicating or self-representing programs) on Combinatory logic.