Make WebSocket support conditional - #643
Conversation
|
cc @MangoIV |
|
The failing formatting check is due to fourmolu not knowing how to parse CPP directives? I find this on ormolu's README:
I can try to accommodate it by moving the directive around. |
|
@andy0130tw It is fine, the formatter check is not blocking. |
|
I would be tempted to try and avoid the CPP entirely. AFAICT the websocket support is entirely additional code. So what we can do is to a) put it in its own module, b) in the cabal file, expose that module only if the flag is set. I think that does everything you want without any CPP? |
|
@michaelpj That requires a structural change, but I would be fine with that. |
MangoIV
left a comment
There was a problem hiding this comment.
Looks like a nice and simple change.
|
I am not a huge opponent of CPP if used sparingly. |
|
Since the websocket specific code is entirely self contained, I think it's not a detriment to the code quality at all. |
|
@MangoIV I also think CPP isn't a huge deal, but I agree that avoiding it altogether and having the WS parts separate could make sense any way. So I am lighlty in favour of the separate module. @andy0130tw Did we exhaust you already or would you attempt moving the WS parts into a separate module? |
|
@fendor I'm leaning towards avoiding CPP here, but I would like to passing on this task as I don't think I have enough context on the overall project architecture. |
Fixes #642.
Makes WebSocket support configurable via a
websocketflag (defaults toTrue). Setting this toFalsestrips out the dependency of packagewebsockets, along with all WebSocket-related implementation, making it compatible with platforms that don't support WebSockets (e.g., the WebAssembly backend).It introduces CPP macros to the project, which makes the code a little bit tangled. Feel free to edit it further.