Hoogle Search

Within LTS Haskell 24.65 (ghc-9.10.3)

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

  1. packedMaybeDerivator :: DataReprAnn -> Derivator

    clash-prelude Clash.Annotations.BitRepresentation.Deriving

    No documentation available.

  2. 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]
    

  3. 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]
    

  4. 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]
    

  5. 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]
    

  6. 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]
    

  7. 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]
    

  8. 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.

  9. 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.

  10. 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.

Page 244 of many | Previous | Next