diff --git a/Main.hs b/Main.hs index b102bbf..a29c145 100644 --- a/Main.hs +++ b/Main.hs @@ -7,6 +7,7 @@ -- base import Control.Concurrent (threadDelay) +import Control.Monad.Fail import Data.Either (rights) import System.IO (hFlush, stdout) import Text.Read (readMaybe) @@ -17,7 +18,7 @@ import Control.Monad.Trans.MSF.Maybe (runMaybeT, MaybeT, exit) -- rhine import FRP.Rhine -import FRP.Rhine.SyncSF.Except +import FRP.Rhine.ClSF.Except import FRP.Rhine.Clock.Realtime.Millisecond import FRP.Rhine.Clock.Realtime.Stdin import FRP.Rhine.Clock.Select @@ -41,5 +42,5 @@ mainRhine = timeless (listToMaybeS "Congratulations! You've installed the tuto -- TODO In dunai 0.1.2 -listToMaybeS :: Monad m => [b] -> MSF (MaybeT m) a b +listToMaybeS :: MonadFail m => [b] -> MSF (MaybeT m) a b listToMaybeS = foldr iPost exit diff --git a/PresentationExamples.hs b/PresentationExamples.hs index efea104..6df30d0 100644 --- a/PresentationExamples.hs +++ b/PresentationExamples.hs @@ -6,11 +6,10 @@ -- dunai import Data.MonadicStreamFunction -import Data.VectorSpace.Specific() -- rhine import FRP.Rhine -import FRP.Rhine.SyncSF.Except +import FRP.Rhine.ClSF.Except import FRP.Rhine.Clock.Realtime.Millisecond --------------------------- @@ -31,13 +30,13 @@ main1 = reactimate type SumClock = Millisecond 100 -fillUp :: Monad m => SyncSF (ExceptT Double m) SumClock Double () +fillUp :: Monad m => ClSF (ExceptT Double m) SumClock Double () fillUp = proc x -> do s <- integral -< x _ <- throwOn' -< (s > 5, s) returnA -< () -helloWorld :: SyncExcept IO SumClock () () Empty + helloWorld = do try $ arr (const 1) >>> fillUp once_ $ putStrLn "Hello World!" @@ -49,20 +48,20 @@ main = flow $ safely helloWorld @@ waitClock data FastClock = FastClock instance Clock m FastClock where - type TimeDomainOf FastClock = () + type Time FastClock = () type Tag FastClock = () - startClock = undefined + initClock = undefined data SlowClock = SlowClock instance Clock m SlowClock where - type TimeDomainOf SlowClock = () + type Time SlowClock = () type Tag SlowClock = () - startClock = undefined + initClock = undefined -fastSignal :: SyncSF m FastClock () a +fastSignal :: ClSF m FastClock () a fastSignal = undefined -slowProcessor :: SyncSF m SlowClock b c +slowProcessor :: ClSF m SlowClock b c slowProcessor = undefined -- uncomment the following for a clock type error diff --git a/Util.hs b/Util.hs index 49264bd..256dccc 100644 --- a/Util.hs +++ b/Util.hs @@ -1,11 +1,11 @@ module Util where --- dunai +import Control.Monad.Fail-- dunai import Control.Monad.Trans.MSF.Except import Data.MonadicStreamFunction -- | Accumulates inputs and starts an MSF for each of them -pool :: Monad m => (a -> MSF m () b) -> MSF m [a] [b] +pool :: MonadFail m => (a -> MSF m () b) -> MSF m [a] [b] pool f = pool' f [] where pool' :: Monad m => (a -> MSF m () b) -> [MSF m () b] -> MSF m [a] [b] @@ -15,7 +15,7 @@ pool f = pool' f [] return (bs, pool' f msfs') -- | Remembers and indefinitely outputs the first input value. -keepFirst :: Monad m => MSF m a a +keepFirst :: MonadFail m => MSF m a a keepFirst = safely $ do a <- try throwS safe $ arr $ const a diff --git a/rhine-tutorial.cabal b/rhine-tutorial.cabal index becdab4..942072d 100644 --- a/rhine-tutorial.cabal +++ b/rhine-tutorial.cabal @@ -20,8 +20,8 @@ executable rhine-tutorial other-modules: Util -- other-extensions: build-depends: base >= 4.8 && < 5 - , dunai == 0.3.* - , rhine == 0.3.* + , dunai + , rhine , transformers == 0.5.* && < 0.6 -- hs-source-dirs: default-language: Haskell2010 @@ -30,8 +30,8 @@ executable presentation-examples main-is: PresentationExamples.hs -- other-extensions: build-depends: base >= 4.8 && < 5 - , dunai == 0.3.* - , rhine == 0.3.* + , dunai + , rhine , transformers == 0.5.* && < 0.6 -- hs-source-dirs: default-language: Haskell2010 diff --git a/stack.yaml b/stack.yaml new file mode 100644 index 0000000..885d57e --- /dev/null +++ b/stack.yaml @@ -0,0 +1,13 @@ +#resolver: nightly-2018-10-12 +resolver: lts-12.11 +extra-deps: +- git: https://github.com/0xCM/rhine.git + commit: 772f913d8fda51b0a0c2ad8b303859fdb7d3863c + subdirs: + - rhine +- git: https://github.com/0xCM/dunai.git + commit: 5505a15b2009e13e233cca8328d520442d3045c6 +- git: https://github.com/expipiplus1/vector-sized.git + commit: f80e3ce774d255ee4ba25fcb12a81a76f600e0b0 +- finite-typelits-0.1.4.2@sha256:d243523297c0526d32e9b7de98e04b79a4227577ddb25d3fecd7981439de243c +- indexed-list-literals-0.2.1.2@sha256:0760e2a86605b5557af7180d4d50e317d75a5a92ca12aaabb6948ce97b7a94ac \ No newline at end of file