
Hugh Perkins wrote:
Is reflection hard in Haskell? In C# its easy, and its one of the most powerful features of C#
That's another way of saying that the truly powerful features are missing from C#...
Yes, but I'm kindof stuck giving useful input to makeConstrM, so if anyone has any ideas?
You mean makeConstr? Well, you don't call that at all. But you do call fromConstrM, and if you don't have suitable input for that, that's when you realizie that you should have written the constructor name or index when serializing.
runM' :: (MonadState [String] m, Monad m, Data a) => m a runM' = do value <- gets head modify tail -- then one of: (pick the non-working function of your choice ;-) : -- return read (fromJust value) -- return (fromJust $ cast value ) -- return (fst $ head $ gread( "(" ++ value ++ ")" ) ) -- return (fromConstrM runM' constr) -- return (fromConstr contr)
Of course not. Wild guesswork will get you nowhere, instead you should read the second SYB paper at http://homepages.cwi.nl/~ralf/syb2/ -Udo