reflex-process: Reflex FRP interface for running system processes

[ bsd3, frp, library, program, system ] [ Propose Tags ]

Run and interact with system processes from within a Reflex FRP application.

https://reflex-frp.org


[Skip to Readme]
Versions [RSS] [faq] 0.1.0.0, 0.1.0.1, 0.2.0.0, 0.2.1.0, 0.3.0.0, 0.3.1.0, 0.3.1.1
Change log ChangeLog.md
Dependencies async (==2.*), base (>=4.12 && <4.15), bytestring (==0.10.*), containers (>=0.5 && <0.7), data-default (>=0.2 && <0.8), process (>=1.6.4 && <1.7), reflex (>=0.7.1 && <0.9), reflex-process, reflex-vty (==0.2.*), text (>=1.2.3 && <1.3), unix (==2.7.*), vty [details]
License BSD-3-Clause
Copyright 2020 Obsidian Systems LLC
Author Obsidian Systems LLC
Maintainer maintainer@obsidian.systems
Category System, FRP
Bug tracker https://github.com/reflex-frp/reflex-process/issues
Source repo head: git clone https://github.com/reflex-frp/reflex-process
Uploaded by abrar at 2021-10-05T19:51:21Z
Distributions NixOS:0.3.1.0
Executables readme
Downloads 1346 total (39 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs uploaded by user
Build status unknown [no reports yet]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Candidates


Readme for reflex-process-0.3.1.1

[back to package description]

reflex-process

Haskell Hackage Hackage CI Travis CI BSD3 License

Functional-reactive system processes

Run and interact with system processes from within a Reflex FRP application.

Example

The following example uses reflex-vty to run a terminal application that calls a shell command and displays the result:

> {-# LANGUAGE OverloadedStrings #-}
> import Reflex
> import Reflex.Process
> import Reflex.Vty
>
> import Control.Monad ((<=<))
> import Data.Default (def)
> import qualified Data.Set as Set
> import qualified Data.Text as T
> import qualified Data.Text.Encoding as T
> import qualified Graphics.Vty.Input as V
> import qualified System.Process as P
>
> cmd :: P.CreateProcess
> cmd = P.proc "ls" ["-a"]
>
> main :: IO ()
> main = mainWidget $ initManager_ $ col $ do
>   exit <- keyCombos $ Set.singleton (V.KChar 'c', [V.MCtrl])
>   p <- createProcess cmd def
>   stdout <- foldDyn (flip mappend) "" $ _process_stdout p
>   grout flex $ boxStatic def $ col $ do
>     grout (fixed 3) $ boxStatic def $ text "reflex-process"
>     grout (fixed 3) $ text "Press Ctrl-C to exit."
>     grout (fixed 2) $ text $ pure $ "Running command: " <> case P.cmdspec cmd of
>       P.ShellCommand s -> T.pack s
>       P.RawCommand p args -> T.intercalate " " $ T.pack <$> (p : args)
>     grout (fixed 1) $ text "stdout:"
>     grout flex $ text $ T.decodeUtf8 <$> current stdout
>   pure $ () <$ exit

Developer environment

You can get ghcid running for working on the code with the command:

nix-shell -E '((import ./reflex-platform {}).ghc.callCabal2nix "reflex-process" ./. {}).env' --run ghcid