[BRLTTY] BrlAPI for Haskell
Mario Lang
mlang at blind.guru
Thu Feb 10 20:30:16 EST 2022
Hi.
Working on a Haskell binding for BrlAPI.
The following example works:
module Main where
import Control.Monad (void)
import BrlAPI
main :: IO ()
main = withConnection "" ":0" $ \c -> do
dn <- getDriverName c
mi <- getModelIdentifier c
(x, _) <- getDisplaySize c
withTty c (Just 5) False $ \tty -> do
writeText c (show (tty, dn, mi, x))
void $ readKey c
Reading the docs again, I am unsure if I want to mimick the low-level
API as much as I usually would. I think it would be better to have a
different type of handle for ttyMode operations. IOW, return some
handle from enterTtyMode and make writeText and friends use that.
This would make the sort of error the docs are talking about impossible,
and that is pretty much the spirit of type-safe FP.
Let me know if you see a big no-no here, otherwise I'll proceed.
--
CYa,
⡍⠁⠗⠊⠕
More information about the BRLTTY
mailing list