
28 Apr
2007
28 Apr
'07
9:10 a.m.
On Sat, Apr 28, 2007 at 02:06:21PM +0100, Eric wrote:
In imperative languages one can test the type of a variable and downcast if necessary. Here's an example in Pseudojava:
T v := ... ; if (v instanceof T') T' v' := (T')v
Is it possible to do something like this in Haskell?
Possible, yes. Usually a good idea - no. Look at the Data.Typeable and Data.Dynamic modules in the standard hierarchal libraries. Stefan