Copyright | (C) 2013 Richard Eisenberg |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | Richard Eisenberg (rae@cs.brynmawr.edu) |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
This module defines a datatype and operations to represent type-level
integers. Though it's defined as part of the units package, it may be
useful beyond dimensional analysis. If you have a compelling non-units
use of this package, please let me (Richard, rae
at cs.brynmawr.edu
)
know.
Synopsis
- data Z
- data family Sing (a :: k) :: Type
- type SZ = (Sing :: Z -> Type)
- type ZeroSym0 = Zero
- data SSym0 :: (~>) Z Z
- type SSym1 (t6989586621679083877 :: Z) = S t6989586621679083877
- data PSym0 :: (~>) Z Z
- type PSym1 (t6989586621679083879 :: Z) = P t6989586621679083879
- zToInt :: Z -> Int
- szToInt :: Sing (z :: Z) -> Int
- type family Succ (z :: Z) :: Z where ...
- type family Pred (z :: Z) :: Z where ...
- type family Negate (z :: Z) :: Z where ...
- type family (a :: Z) #+ (b :: Z) :: Z where ...
- type family (a :: Z) #- (b :: Z) :: Z where ...
- type family (a :: Z) #* (b :: Z) :: Z where ...
- type family (a :: Z) #/ (b :: Z) :: Z where ...
- sSucc :: Sing z -> Sing (Succ z)
- sPred :: Sing z -> Sing (Pred z)
- sNegate :: Sing z -> Sing (Negate z)
- type family (a :: Z) < (b :: Z) :: Bool where ...
- type family NonNegative z :: Constraint where ...
- type One = S Zero
- type Two = S One
- type Three = S Two
- type Four = S Three
- type Five = S Four
- type MOne = P Zero
- type MTwo = P MOne
- type MThree = P MTwo
- type MFour = P MThree
- type MFive = P MFour
- sZero :: Sing Zero
- sOne :: Sing (S Zero)
- sTwo :: Sing (S (S Zero))
- sThree :: Sing (S (S (S Zero)))
- sFour :: Sing (S (S (S (S Zero))))
- sFive :: Sing (S (S (S (S (S Zero)))))
- sMOne :: Sing (P Zero)
- sMTwo :: Sing (P (P Zero))
- sMThree :: Sing (P (P (P Zero)))
- sMFour :: Sing (P (P (P (P Zero))))
- sMFive :: Sing (P (P (P (P (P Zero)))))
- pZero :: Sing Zero
- pOne :: Sing (S Zero)
- pTwo :: Sing (S (S Zero))
- pThree :: Sing (S (S (S Zero)))
- pFour :: Sing (S (S (S (S Zero))))
- pFive :: Sing (S (S (S (S (S Zero)))))
- pMOne :: Sing (P Zero)
- pMTwo :: Sing (P (P Zero))
- pMThree :: Sing (P (P (P Zero)))
- pMFour :: Sing (P (P (P (P Zero))))
- pMFive :: Sing (P (P (P (P (P Zero)))))
- pSucc :: Sing z -> Sing (Succ z)
- pPred :: Sing z -> Sing (Pred z)
The Z
datatype
The datatype for type-level integers.
Instances
Eq Z Source # | |
SEq Z => SEq Z Source # | |
PEq Z Source # | |
SDecide Z => SDecide Z Source # | |
SingKind Z Source # | |
SingI Zero Source # | |
Defined in Data.Metrology.Z | |
SingI n => SingI (S n :: Z) Source # | |
Defined in Data.Metrology.Z | |
SingI n => SingI (P n :: Z) Source # | |
Defined in Data.Metrology.Z | |
SuppressUnusedWarnings PSym0 Source # | |
Defined in Data.Metrology.Z suppressUnusedWarnings :: () # | |
SuppressUnusedWarnings SSym0 Source # | |
Defined in Data.Metrology.Z suppressUnusedWarnings :: () # | |
SingI PSym0 Source # | |
Defined in Data.Metrology.Z | |
SingI SSym0 Source # | |
Defined in Data.Metrology.Z | |
SingI (TyCon1 S) Source # | |
SingI (TyCon1 P) Source # | |
data Sing (a :: Z) Source # | |
type Demote Z Source # | |
Defined in Data.Metrology.Z | |
type (x :: Z) /= (y :: Z) Source # | |
type (a :: Z) == (b :: Z) Source # | |
Defined in Data.Metrology.Z | |
type Apply PSym0 (t6989586621679083879 :: Z) Source # | |
Defined in Data.Metrology.Z | |
type Apply SSym0 (t6989586621679083877 :: Z) Source # | |
Defined in Data.Metrology.Z |
data family Sing (a :: k) :: Type #
The singleton kind-indexed data family.
Instances
data Sing (a :: Bool) | |
data Sing (a :: Ordering) | |
data Sing (n :: Nat) | |
data Sing (n :: Symbol) | |
Defined in Data.Singletons.TypeLits.Internal | |
data Sing (a :: ()) | |
Defined in Data.Singletons.Prelude.Instances | |
data Sing (a :: Z) Source # | |
data Sing (a :: Void) | |
Defined in Data.Singletons.Prelude.Instances | |
data Sing (a :: All) | |
data Sing (a :: Any) | |
data Sing (b :: [a]) | |
data Sing (b :: Maybe a) | |
data Sing (b :: Min a) | |
data Sing (b :: Max a) | |
data Sing (b :: First a) | |
data Sing (b :: Last a) | |
data Sing (a :: WrappedMonoid m) | |
Defined in Data.Singletons.Prelude.Semigroup.Internal data Sing (a :: WrappedMonoid m) where
| |
data Sing (b :: Option a) | |
data Sing (b :: Identity a) | |
data Sing (b :: First a) | |
data Sing (b :: Last a) | |
data Sing (b :: Dual a) | |
data Sing (b :: Sum a) | |
data Sing (b :: Product a) | |
data Sing (b :: Down a) | |
data Sing (b :: NonEmpty a) | |
data Sing (b :: Endo a) | |
data Sing (b :: MaxInternal a) | |
Defined in Data.Singletons.Prelude.Foldable data Sing (b :: MaxInternal a) where
| |
data Sing (b :: MinInternal a) | |
Defined in Data.Singletons.Prelude.Foldable data Sing (b :: MinInternal a) where
| |
data Sing (c :: Either a b) | |
data Sing (c :: (a, b)) | |
data Sing (c :: Arg a b) | |
newtype Sing (f :: k1 ~> k2) | |
data Sing (b :: StateL s a) | |
data Sing (b :: StateR s a) | |
data Sing (d :: (a, b, c)) | |
data Sing (c :: Const a b) | |
data Sing (e :: (a, b, c, d)) | |
data Sing (f :: (a, b, c, d, e)) | |
data Sing (g :: (a, b, c, d, e, f)) | |
Defined in Data.Singletons.Prelude.Instances | |
data Sing (h :: (a, b, c, d, e, f, g)) | |
Defined in Data.Singletons.Prelude.Instances |
Defunctionalization symbols (these can be ignored)
data SSym0 :: (~>) Z Z Source #
Instances
SuppressUnusedWarnings SSym0 Source # | |
Defined in Data.Metrology.Z suppressUnusedWarnings :: () # | |
SingI SSym0 Source # | |
Defined in Data.Metrology.Z | |
type Apply SSym0 (t6989586621679083877 :: Z) Source # | |
Defined in Data.Metrology.Z |
data PSym0 :: (~>) Z Z Source #
Instances
SuppressUnusedWarnings PSym0 Source # | |
Defined in Data.Metrology.Z suppressUnusedWarnings :: () # | |
SingI PSym0 Source # | |
Defined in Data.Metrology.Z | |
type Apply PSym0 (t6989586621679083879 :: Z) Source # | |
Defined in Data.Metrology.Z |
Conversions
Type-level operations
Arithmetic
Comparisons
type family NonNegative z :: Constraint where ... Source #
Check if a type-level integer is in fact a natural number
NonNegative Zero = () | |
NonNegative (S z) = () |
Synonyms for certain numbers
This is the singleton value representing Zero
at the term level and
at the type level, simultaneously. Used for raising units to powers.
Deprecated synonyms
Deprecated: The singleton prefix is changing from p
to s
. The p
versions will be removed in a future release.
pOne :: Sing (S Zero) Source #
Deprecated: The singleton prefix is changing from p
to s
. The p
versions will be removed in a future release.
pTwo :: Sing (S (S Zero)) Source #
Deprecated: The singleton prefix is changing from p
to s
. The p
versions will be removed in a future release.
pThree :: Sing (S (S (S Zero))) Source #
Deprecated: The singleton prefix is changing from p
to s
. The p
versions will be removed in a future release.
pFour :: Sing (S (S (S (S Zero)))) Source #
Deprecated: The singleton prefix is changing from p
to s
. The p
versions will be removed in a future release.
pFive :: Sing (S (S (S (S (S Zero))))) Source #
Deprecated: The singleton prefix is changing from p
to s
. The p
versions will be removed in a future release.
pMOne :: Sing (P Zero) Source #
Deprecated: The singleton prefix is changing from p
to s
. The p
versions will be removed in a future release.
pMTwo :: Sing (P (P Zero)) Source #
Deprecated: The singleton prefix is changing from p
to s
. The p
versions will be removed in a future release.
pMThree :: Sing (P (P (P Zero))) Source #
Deprecated: The singleton prefix is changing from p
to s
. The p
versions will be removed in a future release.
pMFour :: Sing (P (P (P (P Zero)))) Source #
Deprecated: The singleton prefix is changing from p
to s
. The p
versions will be removed in a future release.
pMFive :: Sing (P (P (P (P (P Zero))))) Source #
Deprecated: The singleton prefix is changing from p
to s
. The p
versions will be removed in a future release.