Hoogle Search

Within LTS Haskell 24.51 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. delayMaybe :: forall (dom :: Domain) a . (KnownDomain dom, NFDataX a) => Clock dom -> Enable dom -> a -> Signal dom (Maybe a) -> Signal dom a

    clash-prelude Clash.Explicit.Signal

    Version of delay that only updates when its third argument is a Just value.

    >>> let input = fromList [Just 1, Just 2, Nothing, Nothing, Just 5, Just 6, Just (7::Int)]
    
    >>> sampleN 7 (delayMaybe systemClockGen enableGen 0 input)
    [0,1,2,2,2,5,6]
    

  2. regMaybe :: forall (dom :: Domain) a . (KnownDomain dom, NFDataX a) => Clock dom -> Reset dom -> Enable dom -> a -> Signal dom (Maybe a) -> Signal dom a

    clash-prelude Clash.Explicit.Signal

    Version of register that only updates its content when its fourth argument is a Just value. So given:

    sometimes1 clk rst en = s where
    s = register clk rst en Nothing (switch <$> s)
    
    switch Nothing = Just 1
    switch _       = Nothing
    
    countSometimes clk rst en = s where
    s     = regMaybe clk rst en 0 (plusM (pure <$> s) (sometimes1 clk rst en))
    plusM = liftA2 (liftA2 (+))
    
    We get:
    >>> sampleN 9 (sometimes1 systemClockGen resetGen enableGen)
    [Nothing,Nothing,Just 1,Nothing,Just 1,Nothing,Just 1,Nothing,Just 1]
    
    >>> sampleN 9 (count systemClockGen resetGen enableGen)
    [0,0,0,1,1,2,2,3,3]
    

  3. delayMaybe :: forall (dom :: Domain) a . (NFDataX a, HiddenClock dom, HiddenEnable dom) => a -> Signal dom (Maybe a) -> Signal dom a

    clash-prelude Clash.Prelude

    Version of delay that only updates when its second argument is a Just value.

    >>> let input = fromList [Just 1, Just 2, Nothing, Nothing, Just 5, Just 6, Just (7::Int)]
    
    >>> sampleN @System 7 (delayMaybe 0 input)
    [0,1,2,2,2,5,6]
    

  4. regMaybe :: forall (dom :: Domain) a . (HiddenClockResetEnable dom, NFDataX a) => a -> Signal dom (Maybe a) -> Signal dom a

    clash-prelude Clash.Prelude

    Version of register that only updates its content when its second argument is a Just value. So given:

    sometimes1 = s where
    s = register Nothing (switch <$> s)
    
    switch Nothing = Just 1
    switch _       = Nothing
    
    countSometimes = s where
    s     = regMaybe 0 (plusM (pure <$> s) sometimes1)
    plusM = liftA2 (liftA2 (+))
    
    We get:
    >>> sampleN @System 9 sometimes1
    [Nothing,Nothing,Just 1,Nothing,Just 1,Nothing,Just 1,Nothing,Just 1]
    
    >>> sampleN @System 9 countSometimes
    [0,0,0,1,1,2,2,3,3]
    

  5. delayMaybe :: forall (dom :: Domain) a . (NFDataX a, HiddenClock dom, HiddenEnable dom) => a -> Signal dom (Maybe a) -> Signal dom a

    clash-prelude Clash.Signal

    Version of delay that only updates when its second argument is a Just value.

    >>> let input = fromList [Just 1, Just 2, Nothing, Nothing, Just 5, Just 6, Just (7::Int)]
    
    >>> sampleN @System 7 (delayMaybe 0 input)
    [0,1,2,2,2,5,6]
    

  6. regMaybe :: forall (dom :: Domain) a . (HiddenClockResetEnable dom, NFDataX a) => a -> Signal dom (Maybe a) -> Signal dom a

    clash-prelude Clash.Signal

    Version of register that only updates its content when its second argument is a Just value. So given:

    sometimes1 = s where
    s = register Nothing (switch <$> s)
    
    switch Nothing = Just 1
    switch _       = Nothing
    
    countSometimes = s where
    s     = regMaybe 0 (plusM (pure <$> s) sometimes1)
    plusM = liftA2 (liftA2 (+))
    
    We get:
    >>> sampleN @System 9 sometimes1
    [Nothing,Nothing,Just 1,Nothing,Just 1,Nothing,Just 1,Nothing,Just 1]
    
    >>> sampleN @System 9 countSometimes
    [0,0,0,1,1,2,2,3,3]
    

  7. fromMaybeX :: MaybeX a -> a

    clash-prelude Clash.XException.MaybeX

    Deconstruct MaybeX into an a - the opposite of toMaybeX. Be careful when using this function, because it might return an XException if the argument was IsX.

  8. hasXToMaybeX :: (NFDataX a, NFData a) => a -> MaybeX a

    clash-prelude Clash.XException.MaybeX

    Construct a MaybeX value. If hasX evaluates to Left, this function will return IsX. Otherwise, it will return IsDefined.

  9. toMaybeX :: a -> MaybeX a

    clash-prelude Clash.XException.MaybeX

    Construct a MaybeX value. If a evaluates to XException, this function will return IsX. Otherwise, it will return IsDefined.

  10. fuseBothMaybe :: forall (m :: Type -> Type) a b r1 c r2 . Monad m => ConduitT a b m r1 -> ConduitT b c m r2 -> ConduitT a c m (Maybe r1, r2)

    classy-prelude-conduit ClassyPrelude.Conduit

    Like fuseBoth, but does not force consumption of the Producer. In the case that the Producer terminates, the result value is provided as a Just value. If it does not terminate, then a Nothing value is returned. One thing to note here is that "termination" here only occurs if the Producer actually yields a Nothing value. For example, with the Producer mapM_ yield [1..5], if five values are requested, the Producer has not yet terminated. Termination only occurs when the sixth value is awaited for and the Producer signals termination. Since 1.2.4

Page 244 of many | Previous | Next