On Thu, Feb 17, 2011 at 2:42 PM, Simon Marlow <simon...@microsoft.com> wrote:
>
>> Just downloaded the latest Alex package from Hackage (different from
>> the one in Ubuntu's repositories by 2 minor versions) and found that
>> the monadUserState wrapper still misses 2 functions for dealing with
>> changes in the user supplied state. Is this intended or it was an
>> unwanted omission?
>
> Could you tell me what's missing?  Is this a regression?
>

Yes, there are two functions (this is the type that I guess they should have)

getUserData :: Alex AlexUserState
setUserData :: AlexUserState -> Alex ()

I've used them in a particular implementation today in this way but
maybe there are other ways to handle them too.

He're the code I've used:

getUserData :: Alex AlexUserState
getUserData = Alex $ \s@AlexState{alex_ust=ud} -> Right (s, ud)

setUserData :: AlexUserState -> Alex ()
setUserData ust = Alex $ \s -> Right (s{alex_ust=ust}, ())

Thanks for the quick input,
-- 
Mihai

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

Reply via email to