[Haskell-cafe] A generics question

Stefan Holdermans stefan at cs.uu.nl
Mon Jun 8 23:50:20 EDT 2009


Henry,

Ah, pressed send way to early. Of course, the definition should change  
a little as well:

  convert :: Data a => Int -> a
  convert i = x    where
      x = fromConstr ( dataTypeConstrs (dataTypeOf x) !! (i - 1) )

Cheers,

   Stefan


More information about the Haskell-Cafe mailing list