haskell / alex

A lexical analyser generator for Haskell
https://hackage.haskell.org/package/alex
BSD 3-Clause "New" or "Revised" License
293 stars 82 forks source link

Expose library component #45

Open Fuuzetsu opened 9 years ago

Fuuzetsu commented 9 years ago

It'd be super nice if Alex exposed some of the types it uses so that any functions working with them don't have to be included directly into the lexers.

For example, in Yi wi have to #include https://github.com/yi-editor/yi/blob/master/yi/src/library/Yi/Lexer/common.hsinc in every lexer we want to use the functions in: if we try to move them to a regular Haskell module, we don't have the types in scope when necessary.

stites commented 6 years ago

I just tried to split out the executable from the library and am getting errors about .x files not being able to find imported haskell modules -- so this ticket isn't as simple as I hoped it to be. Are there any pointers for this ticket? Alternatively, a .x file being able to read from some haskell source (with alex types) is exactly the problem the common.hsinc was made to work around, so understanding this better would, in my mind, also close this ticket.