packages feed

rhine-terminal 0.9 → 1.0

raw patch · 4 files changed

+33/−32 lines, 4 filesdep +monad-scheduledep ~rhinePVP ok

version bump matches the API change (PVP)

Dependencies added: monad-schedule

Dependency ranges changed: rhine

API changes (from Hackage documentation)

- FRP.Rhine.Terminal: terminalConcurrently :: forall t cl1 cl2. (Terminal t, Clock (TerminalT t IO) cl1, Clock (TerminalT t IO) cl2, Time cl1 ~ Time cl2) => Schedule (TerminalT t IO) cl1 cl2
+ FRP.Rhine.Terminal: instance (GHC.Base.Monad m, Control.Monad.Schedule.Class.MonadSchedule m) => Control.Monad.Schedule.Class.MonadSchedule (System.Terminal.TerminalT.TerminalT t m)
+ FRP.Rhine.Terminal: runTerminalClock :: Terminal t => t -> cl -> RunTerminalClock IO t cl
+ FRP.Rhine.Terminal: type RunTerminalClock m t cl = HoistClock (TerminalT t m) m cl

Files

ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for rhine-terminal +## 1.0++* Removed schedules. See the [page about changes in version 1](/version1.md).+ ## 0.8.1 -- 2022-05-21  * First version. Version numbers follow rhine.
TerminalSimple.hs view
@@ -58,7 +58,7 @@  type PromptClock = LiftClock IO (TerminalT LocalTerminal) (Millisecond 1000) -type AppClock = ParallelClock App InputClock PromptClock+type AppClock = ParallelClock InputClock PromptClock  -- ClSFs @@ -97,7 +97,7 @@ -- Rhines  mainRhine :: Rhine App AppClock () ()-mainRhine = inputRhine ||@ terminalConcurrently @|| promptRhine+mainRhine = inputRhine |@| promptRhine   where     inputRhine :: Rhine App InputClock () ()     inputRhine = inputSource >-> inputSink @@ inputClock
rhine-terminal.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                rhine-terminal-version:             0.9+version:             1.0 synopsis:            Terminal backend for Rhine description:   This package provides an example of a `terminal` based program using rhine.@@ -24,7 +24,7 @@ source-repository this   type:     git   location: https://github.com/turion/rhine.git-  tag:      v0.9+  tag:      v1.0  library   exposed-modules:@@ -32,10 +32,11 @@   build-depends:       base         >= 4.11 && < 4.18                      , exceptions   >= 0.10.4                      , transformers >= 0.5-                     , rhine        == 0.9+                     , rhine        == 1.0                      , dunai        ^>= 0.9                      , terminal     >= 0.2.0.0                      , time         >= 1.9.3+                     , monad-schedule >= 0.1.2   hs-source-dirs:      src   default-language:    Haskell2010   ghc-options:         -W@@ -48,7 +49,7 @@   main-is:             TerminalSimple.hs   ghc-options:         -threaded   build-depends:       base         >= 4.14 && < 4.18-                     , rhine        == 0.9+                     , rhine        == 1.0                      , rhine-terminal                      , terminal     >= 0.2.0.0                      , text         >= 1.2.5.0@@ -66,7 +67,7 @@   main-is:             tests/Main.hs   ghc-options:         -threaded   build-depends:       base         >= 4.14 && < 4.18-                     , rhine        == 0.9+                     , rhine        == 1.0                      , rhine-terminal                      , exceptions   >= 0.10.4                      , transformers >= 0.5
src/FRP/Rhine/Terminal.hs view
@@ -9,7 +9,8 @@ module FRP.Rhine.Terminal (   TerminalEventClock (..),   flowTerminal,-  terminalConcurrently,+  RunTerminalClock,+  runTerminalClock, ) where  -- base@@ -28,10 +29,11 @@ import System.Terminal.Internal (Terminal)  -- transformers--import Control.Monad.Trans.Class (lift) import Control.Monad.Trans.Reader +-- monad-schedule+import Control.Monad.Schedule.Class+ -- rhine import FRP.Rhine @@ -84,31 +86,14 @@   m () flowTerminal term clsf = flip runTerminalT term $ flow clsf -{- | A schedule in the 'TerminalT LocalTerminal' transformer,-   supplying the same backend connection to its scheduled clocks.+{- | To escape the 'TerminalT' transformer,+  you can apply this operator to your clock type,+  where @cl@ is a clock in 'TerminalT'.+  The resulting clock is then in @m@. -}-terminalConcurrently ::-  forall t cl1 cl2.-  ( Terminal t-  , Clock (TerminalT t IO) cl1-  , Clock (TerminalT t IO) cl2-  , Time cl1 ~ Time cl2-  ) =>-  Schedule (TerminalT t IO) cl1 cl2-terminalConcurrently =-  Schedule $ \cl1 cl2 -> do-    term <- terminalT ask-    lift $-      first liftTransS-        <$> initSchedule concurrently (runTerminalClock term cl1) (runTerminalClock term cl2)---- Workaround TerminalT constructor not being exported. Should be safe in practice.--- See PR upstream https://github.com/lpeterse/haskell-terminal/pull/18-terminalT :: ReaderT t m a -> TerminalT t m a-terminalT = unsafeCoerce- type RunTerminalClock m t cl = HoistClock (TerminalT t m) m cl +-- | See 'RunTerminalClock'. Apply this to your clock value to remove a 'TerminalT' layer. runTerminalClock ::   Terminal t =>   t ->@@ -119,3 +104,14 @@     { monadMorphism = flip runTerminalT term     , ..     }++-- Workaround TerminalT constructor not being exported. Should be safe in practice.+-- See PR upstream https://github.com/lpeterse/haskell-terminal/pull/18+terminalT :: ReaderT t m a -> TerminalT t m a+terminalT = unsafeCoerce++unTerminalT :: TerminalT t m a -> ReaderT t m a+unTerminalT = unsafeCoerce++instance (Monad m, MonadSchedule m) => MonadSchedule (TerminalT t m) where+  schedule = terminalT . fmap (fmap (fmap terminalT)) . schedule . fmap unTerminalT