Safe Haskell | None |
---|---|
Language | Haskell2010 |
Positive naturals in Peano and binary representations, singletonized and promoted to the type level. This module relies on Template Haskell, so parts of the documentation may be difficult to read. See source-level comments for further details.
- data Pos
- data family Sing a
- type SPos = (Sing :: Pos -> *)
- type PosC p = SingI p
- posToInt :: C z => Pos -> z
- addPos :: Pos -> Pos -> Pos
- sAddPos :: forall t t. Sing t -> Sing t -> Sing (Apply (Apply AddPosSym0 t) t :: Pos)
- type family AddPos a a :: Pos
- subPos :: Pos -> Pos -> Pos
- sSubPos :: forall t t. Sing t -> Sing t -> Sing (Apply (Apply SubPosSym0 t) t :: Pos)
- type family SubPos a a :: Pos
- posType :: Int -> TypeQ
- posDec :: Int -> DecQ
- type OSym0 = O
- data SSym0 l
- type SSym1 t = S t
- data AddPosSym0 l
- data AddPosSym1 l l
- data SubPosSym0 l
- data SubPosSym1 l l
- data Bin
- data family Sing a
- type SBin = (Sing :: Bin -> *)
- type BinC b = SingI b
- binToInt :: C z => Bin -> z
- binType :: Int -> TypeQ
- binDec :: Int -> DecQ
- type B1Sym0 = B1
- data D0Sym0 l
- type D0Sym1 t = D0 t
- data D1Sym0 l
- type D1Sym1 t = D1 t
- intDec :: String -> (Int -> TypeQ) -> Int -> DecQ
- primes :: [Int]
- prime :: Int -> Bool
- type P1 = O
- type P2 = S O
- type P3 = S (S O)
- type P4 = S (S (S O))
- type P5 = S (S (S (S O)))
- type P6 = S (S (S (S (S O))))
- type P7 = S (S (S (S (S (S O)))))
- type P8 = S (S (S (S (S (S (S O))))))
- type P9 = S (S (S (S (S (S (S (S O)))))))
- type P10 = S (S (S (S (S (S (S (S (S O))))))))
- type P11 = S (S (S (S (S (S (S (S (S (S O)))))))))
- type P12 = S (S (S (S (S (S (S (S (S (S (S O))))))))))
- type P13 = S (S (S (S (S (S (S (S (S (S (S (S O)))))))))))
- type P14 = S (S (S (S (S (S (S (S (S (S (S (S (S O))))))))))))
- type P15 = S (S (S (S (S (S (S (S (S (S (S (S (S (S O)))))))))))))
- type P16 = S (S (S (S (S (S (S (S (S (S (S (S (S (S (S O))))))))))))))
- type B1 = B1
- type B2 = D0 B1
- type B3 = D1 B1
- type B4 = D0 (D0 B1)
- type B5 = D1 (D0 B1)
- type B6 = D0 (D1 B1)
- type B7 = D1 (D1 B1)
- type B8 = D0 (D0 (D0 B1))
- type B9 = D1 (D0 (D0 B1))
- type B10 = D0 (D1 (D0 B1))
- type B11 = D1 (D1 (D0 B1))
- type B12 = D0 (D0 (D1 B1))
- type B13 = D1 (D0 (D1 B1))
- type B14 = D0 (D1 (D1 B1))
- type B15 = D1 (D1 (D1 B1))
- type B16 = D0 (D0 (D0 (D0 B1)))
- type B17 = D1 (D0 (D0 (D0 B1)))
- type B18 = D0 (D1 (D0 (D0 B1)))
- type B19 = D1 (D1 (D0 (D0 B1)))
- type B20 = D0 (D0 (D1 (D0 B1)))
- type B21 = D1 (D0 (D1 (D0 B1)))
- type B22 = D0 (D1 (D1 (D0 B1)))
- type B23 = D1 (D1 (D1 (D0 B1)))
- type B24 = D0 (D0 (D0 (D1 B1)))
- type B25 = D1 (D0 (D0 (D1 B1)))
- type B26 = D0 (D1 (D0 (D1 B1)))
- type B27 = D1 (D1 (D0 (D1 B1)))
- type B28 = D0 (D0 (D1 (D1 B1)))
- type B29 = D1 (D0 (D1 (D1 B1)))
- type B30 = D0 (D1 (D1 (D1 B1)))
- type B31 = D1 (D1 (D1 (D1 B1)))
- type B32 = D0 (D0 (D0 (D0 (D0 B1))))
- type B33 = D1 (D0 (D0 (D0 (D0 B1))))
- type B34 = D0 (D1 (D0 (D0 (D0 B1))))
- type B35 = D1 (D1 (D0 (D0 (D0 B1))))
- type B36 = D0 (D0 (D1 (D0 (D0 B1))))
- type B37 = D1 (D0 (D1 (D0 (D0 B1))))
- type B38 = D0 (D1 (D1 (D0 (D0 B1))))
- type B39 = D1 (D1 (D1 (D0 (D0 B1))))
- type B40 = D0 (D0 (D0 (D1 (D0 B1))))
- type B41 = D1 (D0 (D0 (D1 (D0 B1))))
- type B42 = D0 (D1 (D0 (D1 (D0 B1))))
- type B43 = D1 (D1 (D0 (D1 (D0 B1))))
- type B44 = D0 (D0 (D1 (D1 (D0 B1))))
- type B45 = D1 (D0 (D1 (D1 (D0 B1))))
- type B46 = D0 (D1 (D1 (D1 (D0 B1))))
- type B47 = D1 (D1 (D1 (D1 (D0 B1))))
- type B48 = D0 (D0 (D0 (D0 (D1 B1))))
- type B49 = D1 (D0 (D0 (D0 (D1 B1))))
- type B50 = D0 (D1 (D0 (D0 (D1 B1))))
- type B51 = D1 (D1 (D0 (D0 (D1 B1))))
- type B52 = D0 (D0 (D1 (D0 (D1 B1))))
- type B53 = D1 (D0 (D1 (D0 (D1 B1))))
- type B54 = D0 (D1 (D1 (D0 (D1 B1))))
- type B55 = D1 (D1 (D1 (D0 (D1 B1))))
- type B56 = D0 (D0 (D0 (D1 (D1 B1))))
- type B57 = D1 (D0 (D0 (D1 (D1 B1))))
- type B58 = D0 (D1 (D0 (D1 (D1 B1))))
- type B59 = D1 (D1 (D0 (D1 (D1 B1))))
- type B60 = D0 (D0 (D1 (D1 (D1 B1))))
- type B61 = D1 (D0 (D1 (D1 (D1 B1))))
- type B62 = D0 (D1 (D1 (D1 (D1 B1))))
- type B63 = D1 (D1 (D1 (D1 (D1 B1))))
- type B64 = D0 (D0 (D0 (D0 (D0 (D0 B1)))))
- type B65 = D1 (D0 (D0 (D0 (D0 (D0 B1)))))
- type B66 = D0 (D1 (D0 (D0 (D0 (D0 B1)))))
- type B67 = D1 (D1 (D0 (D0 (D0 (D0 B1)))))
- type B68 = D0 (D0 (D1 (D0 (D0 (D0 B1)))))
- type B69 = D1 (D0 (D1 (D0 (D0 (D0 B1)))))
- type B70 = D0 (D1 (D1 (D0 (D0 (D0 B1)))))
- type B71 = D1 (D1 (D1 (D0 (D0 (D0 B1)))))
- type B72 = D0 (D0 (D0 (D1 (D0 (D0 B1)))))
- type B73 = D1 (D0 (D0 (D1 (D0 (D0 B1)))))
- type B74 = D0 (D1 (D0 (D1 (D0 (D0 B1)))))
- type B75 = D1 (D1 (D0 (D1 (D0 (D0 B1)))))
- type B76 = D0 (D0 (D1 (D1 (D0 (D0 B1)))))
- type B77 = D1 (D0 (D1 (D1 (D0 (D0 B1)))))
- type B78 = D0 (D1 (D1 (D1 (D0 (D0 B1)))))
- type B79 = D1 (D1 (D1 (D1 (D0 (D0 B1)))))
- type B80 = D0 (D0 (D0 (D0 (D1 (D0 B1)))))
- type B81 = D1 (D0 (D0 (D0 (D1 (D0 B1)))))
- type B82 = D0 (D1 (D0 (D0 (D1 (D0 B1)))))
- type B83 = D1 (D1 (D0 (D0 (D1 (D0 B1)))))
- type B84 = D0 (D0 (D1 (D0 (D1 (D0 B1)))))
- type B85 = D1 (D0 (D1 (D0 (D1 (D0 B1)))))
- type B86 = D0 (D1 (D1 (D0 (D1 (D0 B1)))))
- type B87 = D1 (D1 (D1 (D0 (D1 (D0 B1)))))
- type B88 = D0 (D0 (D0 (D1 (D1 (D0 B1)))))
- type B89 = D1 (D0 (D0 (D1 (D1 (D0 B1)))))
- type B90 = D0 (D1 (D0 (D1 (D1 (D0 B1)))))
- type B91 = D1 (D1 (D0 (D1 (D1 (D0 B1)))))
- type B92 = D0 (D0 (D1 (D1 (D1 (D0 B1)))))
- type B93 = D1 (D0 (D1 (D1 (D1 (D0 B1)))))
- type B94 = D0 (D1 (D1 (D1 (D1 (D0 B1)))))
- type B95 = D1 (D1 (D1 (D1 (D1 (D0 B1)))))
- type B96 = D0 (D0 (D0 (D0 (D0 (D1 B1)))))
- type B97 = D1 (D0 (D0 (D0 (D0 (D1 B1)))))
- type B98 = D0 (D1 (D0 (D0 (D0 (D1 B1)))))
- type B99 = D1 (D1 (D0 (D0 (D0 (D1 B1)))))
- type B100 = D0 (D0 (D1 (D0 (D0 (D1 B1)))))
- type B101 = D1 (D0 (D1 (D0 (D0 (D1 B1)))))
- type B102 = D0 (D1 (D1 (D0 (D0 (D1 B1)))))
- type B103 = D1 (D1 (D1 (D0 (D0 (D1 B1)))))
- type B104 = D0 (D0 (D0 (D1 (D0 (D1 B1)))))
- type B105 = D1 (D0 (D0 (D1 (D0 (D1 B1)))))
- type B106 = D0 (D1 (D0 (D1 (D0 (D1 B1)))))
- type B107 = D1 (D1 (D0 (D1 (D0 (D1 B1)))))
- type B108 = D0 (D0 (D1 (D1 (D0 (D1 B1)))))
- type B109 = D1 (D0 (D1 (D1 (D0 (D1 B1)))))
- type B110 = D0 (D1 (D1 (D1 (D0 (D1 B1)))))
- type B111 = D1 (D1 (D1 (D1 (D0 (D1 B1)))))
- type B112 = D0 (D0 (D0 (D0 (D1 (D1 B1)))))
- type B113 = D1 (D0 (D0 (D0 (D1 (D1 B1)))))
- type B114 = D0 (D1 (D0 (D0 (D1 (D1 B1)))))
- type B115 = D1 (D1 (D0 (D0 (D1 (D1 B1)))))
- type B116 = D0 (D0 (D1 (D0 (D1 (D1 B1)))))
- type B117 = D1 (D0 (D1 (D0 (D1 (D1 B1)))))
- type B118 = D0 (D1 (D1 (D0 (D1 (D1 B1)))))
- type B119 = D1 (D1 (D1 (D0 (D1 (D1 B1)))))
- type B120 = D0 (D0 (D0 (D1 (D1 (D1 B1)))))
- type B121 = D1 (D0 (D0 (D1 (D1 (D1 B1)))))
- type B122 = D0 (D1 (D0 (D1 (D1 (D1 B1)))))
- type B123 = D1 (D1 (D0 (D1 (D1 (D1 B1)))))
- type B124 = D0 (D0 (D1 (D1 (D1 (D1 B1)))))
- type B125 = D1 (D0 (D1 (D1 (D1 (D1 B1)))))
- type B126 = D0 (D1 (D1 (D1 (D1 (D1 B1)))))
- type B127 = D1 (D1 (D1 (D1 (D1 (D1 B1)))))
- type B128 = D0 (D0 (D0 (D0 (D0 (D0 (D0 B1))))))
Positive naturals in Peano representation
data family Sing a
The singleton kind-indexed data family.
data Sing Bool where | |
data Sing Ordering where | |
data Sing Nat where | |
data Sing Symbol where
| |
data Sing () where | |
data Sing Pos where | |
data Sing Bin where | |
data Sing Prime where | |
data Sing PrimePower where
| |
data Sing Factored where | |
data Sing [a0] where | |
data Sing (Maybe a0) where | |
data Sing (TyFun k1 k2 -> *) = SLambda {} | |
data Sing (Either a0 b0) where | |
data Sing ((,) a0 b0) where | |
data Sing ((,,) a0 b0 c0) where | |
data Sing ((,,,) a0 b0 c0 d0) where | |
data Sing ((,,,,) a0 b0 c0 d0 e0) where | |
data Sing ((,,,,,) a0 b0 c0 d0 e0 f0) where | |
data Sing ((,,,,,,) a0 b0 c0 d0 e0 f0 g0) where |
data AddPosSym0 l Source
SuppressUnusedWarnings (TyFun Pos (TyFun Pos Pos -> *) -> *) AddPosSym0 Source | |
type Apply (TyFun Pos Pos -> *) Pos AddPosSym0 l0 = AddPosSym1 l0 Source |
data AddPosSym1 l l Source
SuppressUnusedWarnings (Pos -> TyFun Pos Pos -> *) AddPosSym1 Source | |
type Apply Pos Pos (AddPosSym1 l1) l0 Source |
data SubPosSym0 l Source
SuppressUnusedWarnings (TyFun Pos (TyFun Pos Pos -> *) -> *) SubPosSym0 Source | |
type Apply (TyFun Pos Pos -> *) Pos SubPosSym0 l0 = SubPosSym1 l0 Source |
data SubPosSym1 l l Source
SuppressUnusedWarnings (Pos -> TyFun Pos Pos -> *) SubPosSym1 Source | |
type Apply Pos Pos (SubPosSym1 l1) l0 Source |
Positive naturals in binary representation
data family Sing a
The singleton kind-indexed data family.
data Sing Bool where | |
data Sing Ordering where | |
data Sing Nat where | |
data Sing Symbol where
| |
data Sing () where | |
data Sing Pos where | |
data Sing Bin where | |
data Sing Prime where | |
data Sing PrimePower where
| |
data Sing Factored where | |
data Sing [a0] where | |
data Sing (Maybe a0) where | |
data Sing (TyFun k1 k2 -> *) = SLambda {} | |
data Sing (Either a0 b0) where | |
data Sing ((,) a0 b0) where | |
data Sing ((,,) a0 b0 c0) where | |
data Sing ((,,,) a0 b0 c0 d0) where | |
data Sing ((,,,,) a0 b0 c0 d0 e0) where | |
data Sing ((,,,,,) a0 b0 c0 d0 e0 f0) where | |
data Sing ((,,,,,,) a0 b0 c0 d0 e0 f0 g0) where |
Miscellaneous
Template Haskell splice that declares a type synonym
pfxn
as the type f n
.
Search for the argument in primes
. This is not particularly
fast, but works well enough for moderate-sized numbers that would
appear as (divisors of) cyclotomic indices of interest.