Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- castNFixedToFixed :: (NFixed p : s) :-> (Fixed p : s)
- castFixedToNFixed :: (Fixed p : s) :-> (Maybe (NFixed p) : s)
- unsafeCastFixedToNFixed :: (Fixed p : s) :-> (NFixed p : s)
- newtype Fixed (a :: k) = MkFixed Integer
- newtype NFixed p = MkNFixed Natural
- type LorentzFixedBaseKind = LorentzFixedBaseKindTag -> Type
- data DecBase :: Nat -> LorentzFixedBaseKind
- data BinBase :: Nat -> LorentzFixedBaseKind
- resolution_ :: forall a. HasResolution a => Natural
- toFixed :: forall a f base t s. (a ~ f (base t), LorentzFixedBase base, Unwrappable a, KnownNat t, ArithOpHs Mul Natural (Unwrappabled a) (Unwrappabled a)) => (Unwrappabled a : s) :-> (a : s)
- fromFixed :: forall a f base t s. (a ~ f (base t), ToT (f (base 0)) ~ ToT (Unwrappabled a), LorentzRounding a (f (base 0))) => (a : s) :-> (Unwrappabled a : s)
- class Typeable a => LorentzFixedBase a
- getBase :: (LorentzFixedBase a, Num b) => b
Lorentz instructions
Typeclasses
The type parameter should be an instance of HasResolution
.
Instances
DivIntegralConstraint r b => ArithOpHs Div Integer Integer (Maybe (Fixed (b r))) Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
DivIntegralConstraint r b => ArithOpHs Div Integer Natural (Maybe (Fixed (b r))) Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
DivIntegralConstraint r b => ArithOpHs Div Natural Integer (Maybe (Fixed (b r))) Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
DivIntegralConstraint r b => ArithOpHs Div Natural Natural (Maybe (Fixed (b r))) Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
DivConstraint1 a t r (Fixed :: LorentzFixedBaseKind -> Type) b1 => ArithOpHs Div Integer (Fixed (b1 a)) r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
DivConstraint1 a t r (Fixed :: LorentzFixedBaseKind -> Type) b1 => ArithOpHs Div Natural (Fixed (b1 a)) r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
r ~ Fixed p => ArithOpHs Add Integer (Fixed p) r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
r ~ Fixed p => ArithOpHs Add Natural (Fixed p) r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
r ~ Fixed p => ArithOpHs Mul Integer (Fixed p) r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
r ~ Fixed p => ArithOpHs Mul Natural (Fixed p) r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
r ~ Fixed p => ArithOpHs Sub Integer (Fixed p) r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
r ~ Fixed p => ArithOpHs Sub Natural (Fixed p) r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
UnaryArithOpHs Neg (Fixed p) Source # | |
Defined in Lorentz.CustomArith.FixedArith type UnaryArithResHs Neg (Fixed p) Source # evalUnaryArithOpHs :: forall (s :: [Type]). (Fixed p ': s) :-> (UnaryArithResHs Neg (Fixed p) ': s) Source # | |
r ~ Fixed p => ArithOpHs Add (Fixed p) Integer r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
r ~ Fixed p => ArithOpHs Add (Fixed p) Natural r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
(r ~ Maybe (Integer, NFixed (base a)), KnownNat a, LorentzFixedBase base) => ArithOpHs EDiv (Fixed (base a)) Integer r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
(r ~ Maybe (Integer, NFixed (base a)), KnownNat a, LorentzFixedBase base) => ArithOpHs EDiv (Fixed (base a)) Natural r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
r ~ Fixed p => ArithOpHs Mul (Fixed p) Integer r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
r ~ Fixed p => ArithOpHs Mul (Fixed p) Natural r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
r ~ Fixed p => ArithOpHs Sub (Fixed p) Integer r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
r ~ Fixed p => ArithOpHs Sub (Fixed p) Natural r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
DivConstraint a b t r (Fixed :: LorentzFixedBaseKind -> Type) b1 b2 => ArithOpHs Div (Fixed (b1 a)) (Fixed (b2 b)) r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
r ~ Fixed p => ArithOpHs Add (Fixed p) (Fixed p) r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
r ~ Fixed p => ArithOpHs Add (Fixed p) (NFixed p) r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
r ~ Fixed p => ArithOpHs Add (NFixed p) (Fixed p) r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
(r ~ Fixed (b1 (a + b)), b1 ~ b2) => ArithOpHs Mul (Fixed (b1 a)) (Fixed (b2 b)) r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
(r ~ Fixed (b1 (a + b)), b1 ~ b2) => ArithOpHs Mul (Fixed (b1 a)) (NFixed (b2 b)) r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
(r ~ Fixed (b1 (a + b)), b1 ~ b2) => ArithOpHs Mul (NFixed (b1 a)) (Fixed (b2 b)) r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
r ~ Fixed p => ArithOpHs Sub (Fixed p) (Fixed p) r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
r ~ Fixed p => ArithOpHs Sub (Fixed p) (NFixed p) r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
r ~ Fixed p => ArithOpHs Sub (NFixed p) (Fixed p) r Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
NFData1 (Fixed :: Type -> Type) | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
HasResolution a => ToJSON (Fixed a) | |
Defined in Data.Aeson.Types.ToJSON | |
HasResolution a => ToJSONKey (Fixed a) | |
Defined in Data.Aeson.Types.ToJSON toJSONKey :: ToJSONKeyFunction (Fixed a) # toJSONKeyList :: ToJSONKeyFunction [Fixed a] # | |
(Typeable k, Typeable a) => Data (Fixed a) | Since: base-4.1.0.0 |
Defined in Data.Fixed gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Fixed a -> c (Fixed a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Fixed a) # toConstr :: Fixed a -> Constr # dataTypeOf :: Fixed a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Fixed a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Fixed a)) # gmapT :: (forall b. Data b => b -> b) -> Fixed a -> Fixed a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Fixed a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Fixed a -> r # gmapQ :: (forall d. Data d => d -> u) -> Fixed a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Fixed a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Fixed a -> m (Fixed a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Fixed a -> m (Fixed a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Fixed a -> m (Fixed a) # | |
Enum (Fixed a) | Recall that, for numeric types, succ (0.000 :: Milli) == 0.001 and likewise pred (0.000 :: Milli) == -0.001 In other words, succ (0.000000000000 :: Pico) == 0.000000000001 and similarly pred (0.000000000000 :: Pico) == -0.000000000001 This is worth bearing in mind when defining [1..10] :: [Pico] evaluates to However, this is not true. On the contrary, similarly to the above
implementations of [1.000000000000, 1.00000000001, 1.00000000002, ..., 10.000000000000] and contains Since: base-2.1 |
HasResolution a => Num (Fixed a) | Since: base-2.1 |
HasResolution a => Read (Fixed a) | Since: base-4.3.0.0 |
HasResolution a => Fractional (Fixed a) | Since: base-2.1 |
HasResolution a => Real (Fixed a) | Since: base-2.1 |
Defined in Data.Fixed toRational :: Fixed a -> Rational # | |
HasResolution a => RealFrac (Fixed a) | Since: base-2.1 |
HasResolution a => Show (Fixed a) | Since: base-2.1 |
NFData (Fixed a) | Since: deepseq-1.3.0.0 |
Defined in Control.DeepSeq | |
Eq (Fixed a) | Since: base-2.1 |
Ord (Fixed a) | Since: base-2.1 |
Hashable (Fixed a) | |
Defined in Data.Hashable.Class | |
Unwrappable (Fixed a) Source # | |
Defined in Lorentz.Wrappable type Unwrappabled (Fixed a) Source # | |
IsoValue (Fixed p) | |
HasResolution a => Ring (Fixed a) | |
Defined in Data.Semiring | |
HasResolution a => Semiring (Fixed a) | |
(KnownNat a, KnownNat b, b1 ~ b2, LorentzFixedBase b1) => LorentzRounding (Fixed (b1 a)) (Fixed (b2 b)) Source # | Round is implemented using "banker's rounding" strategy, rounding half-way values towards nearest even value |
type UnaryArithResHs Neg (Fixed p) Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
type Unwrappabled (Fixed a) Source # | |
Defined in Lorentz.Wrappable | |
type ToT (Fixed p) | |
Defined in Morley.Michelson.Typed.Haskell.Value | |
type PrettyShow (Fixed _1) | |
Defined in Morley.Prelude.Show type PrettyShow (Fixed _1) = () |
Like Fixed
but with a Natural
value inside constructor
Instances
Support types and functions
type LorentzFixedBaseKind = LorentzFixedBaseKindTag -> Type Source #
Open kind for fixed value bases.
data DecBase :: Nat -> LorentzFixedBaseKind Source #
Represents decimal base of the Lorentz fixed-point values
Instances
LorentzFixedBase DecBase Source # | |
Defined in Lorentz.CustomArith.FixedArith |
data BinBase :: Nat -> LorentzFixedBaseKind Source #
Represents binary base of the Lorentz fixed-point values
Instances
LorentzFixedBase BinBase Source # | |
Defined in Lorentz.CustomArith.FixedArith |
resolution_ :: forall a. HasResolution a => Natural Source #
Special function to get resolution without argument
toFixed :: forall a f base t s. (a ~ f (base t), LorentzFixedBase base, Unwrappable a, KnownNat t, ArithOpHs Mul Natural (Unwrappabled a) (Unwrappabled a)) => (Unwrappabled a : s) :-> (a : s) Source #
Convert from the corresponding integral type.
fromFixed :: forall a f base t s. (a ~ f (base t), ToT (f (base 0)) ~ ToT (Unwrappabled a), LorentzRounding a (f (base 0))) => (a : s) :-> (Unwrappabled a : s) Source #
Convert to the corresponding integral type by banker's rounding.
class Typeable a => LorentzFixedBase a Source #
Instances
LorentzFixedBase BinBase Source # | |
Defined in Lorentz.CustomArith.FixedArith | |
LorentzFixedBase DecBase Source # | |
Defined in Lorentz.CustomArith.FixedArith |
Internals
getBase :: (LorentzFixedBase a, Num b) => b Source #