Re: [Haskell-cafe] Hoopl: Combining CheckingFuelMonad with State?

2011-06-27 Thread Justin Bailey
I asked this question on StackOverflow and someone suggested using
StateT. Unfortunately I don't think I can really carry around the
state I'd like to:

  
http://stackoverflow.com/questions/6495320/hoopl-how-can-i-combine-the-checkingfuelmonad-with-a-state-monad



On Fri, Jun 24, 2011 at 5:56 PM, Antoine Latter aslat...@gmail.com wrote:
 Hi Justin, this message might be better on the haskell-cafe list (or
 the excellent beginers list!).

 When you tried to write the get/put implementations, what problems
 were you running into?

 Antoine

 On Sat, Jun 25, 2011 at 7:50 AM, Justin Bailey jgbai...@gmail.com wrote:
 I'd like to carry around some state when rewriting. It seems like
 CheckingFuelMonad, etc. are set up to use with other monads but I
 can't get the types to agree.

 Using MTL I've managed to come up with these types:

 newtype RewriteOnce a = R (State Bool a)
   deriving (Monad)

 instance MonadState s (CheckingFuelMonad RewriteOnce) where
   get = undefined
   put = undefined


 But I cannot write the definitions for get and put. Is this possible
 or am I misundersanding CheckingFuelMonad? Is there a better approach
 altogether?

 Thanks in advance for any help!

 Justin

 ___
 Glasgow-haskell-users mailing list
 glasgow-haskell-us...@haskell.org
 http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Hoopl: Combining CheckingFuelMonad with State?

2011-06-24 Thread Antoine Latter
Hi Justin, this message might be better on the haskell-cafe list (or
the excellent beginers list!).

When you tried to write the get/put implementations, what problems
were you running into?

Antoine

On Sat, Jun 25, 2011 at 7:50 AM, Justin Bailey jgbai...@gmail.com wrote:
 I'd like to carry around some state when rewriting. It seems like
 CheckingFuelMonad, etc. are set up to use with other monads but I
 can't get the types to agree.

 Using MTL I've managed to come up with these types:

 newtype RewriteOnce a = R (State Bool a)
   deriving (Monad)

 instance MonadState s (CheckingFuelMonad RewriteOnce) where
   get = undefined
   put = undefined


 But I cannot write the definitions for get and put. Is this possible
 or am I misundersanding CheckingFuelMonad? Is there a better approach
 altogether?

 Thanks in advance for any help!

 Justin

 ___
 Glasgow-haskell-users mailing list
 glasgow-haskell-us...@haskell.org
 http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe