-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Elm signal system for Haskell -- -- Ramus is a direct port of purescript-signal into Haskell, offering the -- Elm signal system for Haskell. @package ramus @version 0.1.0 module Ramus.Signal data Signal a Signal :: a -> (a -> IO ()) -> ((a -> IO ()) -> IO ()) -> Signal a [get] :: Signal a -> a [set] :: Signal a -> a -> IO () [subscribe] :: Signal a -> (a -> IO ()) -> IO () unsafeRef :: a -> IORef a unsafeRead :: IORef a -> a make :: a -> Signal a -- | Creates a signal with a constant value. constant :: a -> Signal a -- | Merge two signals, returning a new signal which will yield a value -- |whenever either of the input signals yield. Its initial value will be -- |that of the first signal. merge :: Signal a -> Signal a -> Signal a -- | Merge all signals inside a Foldable, returning a Maybe -- which will |either contain the resulting signal, or Nothing if -- the Foldable |was empty. mergeMany :: (Functor f, Foldable f) => f (Signal a) -> Maybe (Signal a) -- | Creates a past dependent signal. The function argument takes the value -- of |the input signal, and the previous value of the output signal, to -- produce |the new value of the output signal. foldp :: (a -> b -> b) -> b -> Signal a -> Signal b -- | Creates a signal which yields the current value of the second signal -- every |time the first signal yields. sampleOn :: Signal a -> Signal b -> Signal b -- | Create a signal which only yields values which aren't equal to the -- previous |value of the input signal. dropRepeats :: (Eq a) => Signal a -> Signal a -- | Given a signal of effects with no return value, run each effect as it -- |comes in. runSignal :: Signal (IO ()) -> IO () -- | Takes a signal of effects of a, and produces an effect which -- returns a |signal which will take each effect produced by the input -- signal, run it, |and yield its returned value. unwrap :: Signal (IO a) -> IO (Signal a) -- | Takes a signal and filters out yielded values for which the provided -- |predicate function returns false. filter :: (a -> Bool) -> a -> Signal a -> Signal a -- | Map a signal over a function which returns a Maybe, yielding -- only the |values inside Justs, dropping the Nothings. filterMap :: (a -> Maybe b) -> b -> Signal a -> Signal b (~>) :: Signal a -> (a -> b) -> Signal b infixl 4 ~> instance GHC.Base.Functor Ramus.Signal.Signal instance GHC.Base.Applicative Ramus.Signal.Signal instance Data.Semigroup.Semigroup (Ramus.Signal.Signal a) module Ramus.Time type Time = Float millisecond :: Time second :: Time -- | Creates a signal which yields the current time (according to -- now) every |given number of milliseconds. every :: Time -> Signal Time -- | Returns the number of milliseconds since an arbitrary, but constant, -- time |in the past. now :: IO Time -- | Takes a signal and delays its yielded values by a given number of -- |milliseconds. delay :: Time -> Signal a -> Signal a -- | Takes a signal and a time value, and creates a signal which yields -- True |when the input signal yields, then goes back to -- False after the given |number of milliseconds have elapsed, -- unless the input signal yields again |in the interim. since :: Time -> Signal a -> Signal Bool -- | Takes a signal and a time value, and creates a signal which waits to -- yield |the next result until the specified amount of time has elapsed. -- It then |yields only the newest value from that period. New events -- during the debounce |period reset the delay. debounce :: Time -> Signal a -> Signal a module Ramus.DOM data CoordinatePair CoordinatePair :: Int -> Int -> CoordinatePair [x] :: CoordinatePair -> Int [y] :: CoordinatePair -> Int data DimensionPair DimensionPair :: Int -> Int -> DimensionPair [w] :: DimensionPair -> Int [h] :: DimensionPair -> Int -- | Creates a signal which will be true when the key matching the -- given key |code is pressed, and false when it's released. keyPressed :: Int -> IO (Signal Bool) -- | Creates a signal which will be true when the given mouse -- button is |pressed, and false when it's released. mouseButton :: Int -> IO (Signal Bool) data Touch Touch :: String -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Float -> Float -> Touch [id] :: Touch -> String [screenX] :: Touch -> Int [screenY] :: Touch -> Int [clientX] :: Touch -> Int [clientY] :: Touch -> Int [pageX] :: Touch -> Int [pageY] :: Touch -> Int [radiusX] :: Touch -> Int [radiusY] :: Touch -> Int [rotationAngle] :: Touch -> Float [force] :: Touch -> Float -- | A signal containing the current state of the touch device, as -- described by |the Touch record type. touch :: IO (Signal [Touch]) -- | A signal which will be true when at least one finger is -- touching the |touch device, and false otherwise. tap :: IO (Signal Bool) -- | A signal containing the current mouse position. mousePos :: IO (Signal CoordinatePair) -- | A signal which yields the current time, as determined by now, -- on every |animation frame (see -- [https:/developer.mozilla.orgen-USdocsWebAPIwindow/requestAnimationFrame]). animationFrame :: IO (Signal Time) -- | A signal which contains the document window's current width and -- height. windowDimensions :: IO (Signal DimensionPair) module Ramus.Channel newtype Channel a Channel :: (Signal a) -> Channel a -- | Creates a channel, which allows you to feed arbitrary values into a -- signal. channel :: a -> IO (Channel a) -- | Sends a value to a given channel. send :: Channel a -> a -> IO () -- | Takes a channel and returns a signal of the values sent to it. subscribe :: Channel a -> Signal a