| Copyright | (C) 2022 QBayLogic B.V. |
|---|---|
| License | BSD2 (see the file LICENSE) |
| Maintainer | QBayLogic B.V. <devops@qbaylogic.com> |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Clash.XException.MaybeX
Description
Helpers to make XException explicit in the type system.
Using these helpers can help programmers account for XExceptions
properly in blackbox models or tests. Note that none of these operations can be
translated to HDL.
Documentation
Structure helping programmers to deal with XException
values. For safety reasons it can't be constructed directly, but should be
constructed using either pure or toMaybeX. After construction, it can be
deconstructed using either IsX or IsDefined.
Bundled Patterns
| pattern IsX :: forall a. String -> MaybeX a | Upon construction, |
| pattern IsDefined :: forall a. a -> MaybeX a | Upon construction, |
Instances
| Applicative MaybeX Source # | Note that |
| Functor MaybeX Source # | Note that |
| Show a => Show (MaybeX a) Source # | |
Construction
toMaybeX :: a -> MaybeX a Source #
Construct a MaybeX value. If a evaluates to XException,
this function will return IsX. Otherwise, it will return IsDefined.
Deconstruction
fromMaybeX :: MaybeX a -> a Source #
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.
Operations
andX :: MaybeX Bool -> MaybeX Bool -> MaybeX Bool infixr 3 Source #
Implements && accounting for X
X | 1 | 0 | |
X | X | X | 0 |
1 | X | 1 | 0 |
0 | 0 | 0 | 0 |