Hoogle Search

Within LTS Haskell 24.38 (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 . (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]
    

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

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

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

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

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

  7. mapOutputMaybe :: forall (m :: Type -> Type) o1 o2 i r . Monad m => (o1 -> Maybe o2) -> ConduitT i o1 m r -> ConduitT i o2 m r

    classy-prelude-conduit ClassyPrelude.Conduit

    Same as mapOutput, but use a function that returns Maybe values. Since 0.5.0

  8. runMaybeC :: forall (m :: Type -> Type) i o r . Monad m => ConduitT i o (MaybeT m) r -> ConduitT i o m (Maybe r)

    classy-prelude-conduit ClassyPrelude.Conduit

    Run MaybeT in the base monad Since 1.0.11

  9. fromMaybe :: forall c (f :: Type -> Type) a . c -> Colonnade f a c -> Colonnade f (Maybe a) c

    colonnade Colonnade

    Lift a column over a Maybe. For example, if some people have houses and some do not, the data that pairs them together could be represented as:

    >>> :{
    let owners :: [(Person,Maybe House)]
    owners =
    [ (Person "Jordan" 18, Nothing)
    , (Person "Ruth" 25, Just (House Red 125000))
    , (Person "Sonia" 12, Just (House Green 145000))
    ]
    :}
    
    The column encodings defined earlier can be reused with the help of fromMaybe:
    >>> :{
    let colOwners :: Colonnade Headed (Person,Maybe House) String
    colOwners = mconcat
    [ lmap fst colPerson
    , lmap snd (fromMaybe "" colHouse)
    ]
    :}
    
    >>> putStr (ascii colOwners owners)
    +--------+-----+-------+---------+
    | Name   | Age | Color | Price   |
    +--------+-----+-------+---------+
    | Jordan | 18  |       |         |
    | Ruth   | 25  | Red   | $125000 |
    | Sonia  | 12  | Green | $145000 |
    +--------+-----+-------+---------+
    

  10. chooseUnrankMaybe :: Int -> Int -> Int -> Maybe [Bool]

    combinatorial Combinatorics

    No documentation available.

Page 240 of many | Previous | Next