# Reflex Bindings to libtelnet This is a [reflex](https://reflex-frp.org/) wrapper around [libtelnet](https://git.sr.ht/~jack/libtelnet-haskell), which lets you describe data flows through the telnet state tracker using reflex `Event`s. This library thinly wraps the libtelnet functions, so you should read [the libtelnet documentation](http://hackage.haskell.org/package/libtelnet) alongside the haddocks for this package. ## Quick Start 1. Assemble a `config :: TelnetConfig t`, which holds the event streams that feed into a telnet state tracker. The easiest way to do this is to call `newTelnetConfig` and overwrite the fields you care about using record updates or lenses. You will almost certainly want to overwrite `recv` to be the stream of incoming data from a socket, and `send` to be the stream of outgoing data from your application. * If you want to use lenses, use the [`generic-lens`](https://hackage.haskell.org/package/generic-lens) or [`generic-optics`](https://hackage.haskell.org/package/generic-optics) to get your preferred flavour of optic. Make sure to use the `field' @"fieldName"` version (i.e. not `#fieldName` or un-primed `field`), otherwise GHC will struggle to infer the type of `t` when setting fields in `ReflexConfig t`. 2. Call `telnet config`, and save the resulting `TelnetEvents t`. This structure holds the output event streams from a single telnet state tracker. 3. Wire the output events into your application. ## Other Resources * A [telnet echo server](https://git.sr.ht/~jack/reflex-libtelnet/tree/master/reflex-libtelnet-example/src/Main.hs) exists in the [`reflex-libtelnet` repo](https://git.sr.ht/~jack/reflex-libtelnet), outside this package. It is packaged separately so that it can be licensed more permissively, and to minimise `reflex-libtelnet`'s dependency footprint. * Questions should go to the [reflex-libtelnet-discuss](https://lists.sr.ht/~jack/reflex-libtelnet-discuss) mailing list. * Bug reports should go to the [bug tracker](https://todo.sr.ht/~jack/reflex-libtelnet).