initialization of AlexUserState

Hi All, I have a Alex lexer with wrapper "monadUserState-bytestring". The AlexUserState = AlexUserState {sheetNames:: {String], currSheet:: Int}. The lexer should check whether a found sheetname is in sheetNames. The sheetNames from AlexUserState come from outside. I want to invoke the lexer many times with different AlexUserStates. Therefore the alexInitUserState function is not what I want. I'de like to initialize the AlexUserState while starting the lexer, i.e. as a parameter to runAlex. Can that be done? Kees --- Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware. https://www.avast.com/antivirus

I would just add a function setAlexUserState :: AlexUserState -> Alex () setAlexUserState = ... and then write another run :: AlexUserState -> Alex () run st = do setAlexUserState st alexMonadScan or what have you On 3/15/19 6:16 AM, Kees Bleijenberg wrote:
Hi All,
I have a Alex lexer with wrapper "monadUserState-bytestring". The AlexUserState = AlexUserState {sheetNames:: {String], currSheet:: Int}. The lexer should check whether a found sheetname is in sheetNames. The sheetNames from AlexUserState come from outside. I want to invoke the lexer many times with different AlexUserStates. Therefore the alexInitUserState function is not what I want. I’de like to initialize the AlexUserState while starting the lexer, i.e. as a parameter to runAlex. Can that be done?
Kees
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient Virusvrij. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
_______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
participants (2)
-
Kees Bleijenberg
-
Vanessa McHale