Re: [Haskell-cafe] Help defining a Typeable polymorphic-state monad transformer

2010-12-07 Thread Brandon Simmons
On Mon, Dec 6, 2010 at 11:53 PM, Luke Palmer lrpal...@gmail.com wrote: This has nothing to do with a monad.  This is just about data.  You want a type that can contain any Typeable type, and a safe way to cast out of that type into the type that came in.  Such a thing exists, it's called

[Haskell-cafe] Help defining a Typeable polymorphic-state monad transformer

2010-12-06 Thread Brandon Simmons
Hi all, I gave myself until this evening to figure this out on my own, and time is up! Hopefully this makes for a good discussion, though the idea could be dumb. What I'm trying to do is define a state monad in which the passed state can change type during the computation. The only constraint is

Re: [Haskell-cafe] Help defining a Typeable polymorphic-state monad transformer

2010-12-06 Thread Luke Palmer
This has nothing to do with a monad. This is just about data. You want a type that can contain any Typeable type, and a safe way to cast out of that type into the type that came in. Such a thing exists, it's called Data.Dynamic. Then your monad is just StateT Dynamic, where your magical