[Haskell-cafe] initialization of AlexUserState

Vanessa McHale vanessa.mchale at iohk.io
Fri Mar 15 14:43:08 UTC 2019


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20190315/a3c34daa/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20190315/a3c34daa/attachment.sig>


More information about the Haskell-Cafe mailing list