Safe Haskell | Trustworthy |
---|---|
Language | Haskell2010 |
NatOptics.Positive
Contents
Synopsis
- data Positive number
- refine :: (Num n, Ord n) => Prism' n (Positive n)
- natPrism :: (Integral n, Bits n) => Prism' Natural (Positive n)
- intPrism :: (Integral n, Bits n) => Prism' Integer (Positive n)
- textPrism :: (Integral n, Bits n) => Prism' Text (Positive n)
- stringPrism :: (Integral n, Bits n) => Prism' String (Positive n)
- data Natural
- data Integer
- type Prism' s a = Optic' A_Prism NoIx s a
- view :: forall k (is :: IxList) s a. Is k A_Getter => Optic' k is s a -> s -> a
- review :: forall k (is :: IxList) t b. Is k A_Review => Optic' k is t b -> b -> t
- preview :: forall k (is :: IxList) s a. Is k An_AffineFold => Optic' k is s a -> s -> Maybe a
Type constructor
Instances
Show number => Show (Positive number) Source # | |
Eq number => Eq (Positive number) Source # | |
Ord number => Ord (Positive number) Source # | |
Defined in NatOptics.Positive.Unsafe Methods compare :: Positive number -> Positive number -> Ordering # (<) :: Positive number -> Positive number -> Bool # (<=) :: Positive number -> Positive number -> Bool # (>) :: Positive number -> Positive number -> Bool # (>=) :: Positive number -> Positive number -> Bool # max :: Positive number -> Positive number -> Positive number # min :: Positive number -> Positive number -> Positive number # |
Optics
Re-exports
Natural number
Invariant: numbers <= 0xffffffffffffffff use the NS
constructor
Instances
Arbitrary precision integers. In contrast with fixed-size integral types
such as Int
, the Integer
type represents the entire infinite range of
integers.
Integers are stored in a kind of sign-magnitude form, hence do not expect two's complement form when using bit operations.
If the value is small (fit into an Int
), IS
constructor is used.
Otherwise IP
and IN
constructors are used to store a BigNat
representing respectively the positive or the negative value magnitude.
Instances
review :: forall k (is :: IxList) t b. Is k A_Review => Optic' k is t b -> b -> t #
Retrieve the value targeted by a Review
.
>>>
review _Left "hi"
Left "hi"
preview :: forall k (is :: IxList) s a. Is k An_AffineFold => Optic' k is s a -> s -> Maybe a #
Retrieve the value targeted by an AffineFold
.
>>>
let _Right = prism Right $ either (Left . Left) Right
>>>
preview _Right (Right 'x')
Just 'x'
>>>
preview _Right (Left 'y')
Nothing