!ZRR      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Safe2=finNat natural numbers.Better than GHC's built-in  for some use cases.fin displaying a structure of .explicitShow 0"Z"explicitShow 2 "S (S Z)"fin displaying a structure of .finFold .cata [] ('x' :) 2"xx"finConvert  to  toNatural 00 toNatural 22toNatural $ S $ S $ Z2finConvert  to  fromNatural 44explicitShow (fromNatural 4)"S (S (S (S Z)))"fin is printed as .To see explicit structure, use  or   None&'.1HSUVX''finMultiplication.'reflect (snat :: SNat (Mult Nat2 Nat3))6(fin Addition.'reflect (snat :: SNat (Plus Nat1 Nat2))3)finConvert from GHC .:kind! FromGHC 7FromGHC 7 :: Nat%= 'S ('S ('S ('S ('S ('S ('S 'Z))))))*finConvert to GHC .:kind! ToGHC Nat5ToGHC Nat5 :: GHC.Nat= 5+fin$The induction will be fully inlined.See test/Inspection.hs.-finType family used to implement  from Data.Type.Equality module..finConvenience class to get 0.0fin Singleton of .3finReflect type-level  to the term level.4finAs 3 but with any .5finReify .reify nat3 reflect36finConvert 0 to .snatToNat (snat :: SNat Nat1)17finConvert 0 to !snatToNatural (snat :: SNat Nat0)0!snatToNatural (snat :: SNat Nat2)28fin&Decide equality of type-level numbers.(eqNat :: Maybe (Nat3 :~: Plus Nat1 Nat2) Just Refl(eqNat :: Maybe (Nat3 :~: Mult Nat2 Nat2)Nothing9fin Induction on ', functor form. Useful for computation.8induction1 (Tagged 0) $ retagMap (+2) :: Tagged Nat3 IntTagged 6:fin Induction on ..Useful in proofs or with GADTs, see source of >.;finSee +.<finUnfold n steps of a general recursion.Note: Always  benchmark". This function may give you both badK properties: a lot of code (increased binary size), and worse performance. For known n <# will unfold recursion, for example < ( ::  #) f = f (f (f (fix f))) =fin  0 + n = n>fin  n + 0 = n?fin  0 * n = 0@fin  n * 0 = 0Afin  1 * n = nBfin  n * 1 = n9fin zero casefininduction step:fin zero casefininduction step;fin zero casefininduction step8  !"#$%&'()*+,-./0123456789:;<=>?@AB801267./5348-:9+,;<('*) &%$#"! =>?@ABNone &'.12HXfGJfinFinite numbers: [0..n-1].MfinMultiplicative inverse. Works for J n where n3 is coprime with an argument, i.e. in general when n is prime.$map inverse universe :: [Fin N.Nat5] [0,1,3,2,4];zipWith (*) universe (map inverse universe) :: [Fin N.Nat5] [0,1,1,1,1]Adaptation of Khttps://en.wikipedia.org/wiki/Extended_Euclidean_algorithm#Modular_integerspseudo-code in WikipediaNfin displaying a structure of J.explicitShow (0 :: Fin N.Nat1)"Z"explicitShow (2 :: Fin N.Nat3) "S (S Z)"Ofin displaying a structure of J.PfinFold J.Qfin Convert to Nat.Rfin Convert from Nat.$fromNat N.nat1 :: Maybe (Fin N.Nat2)Just 1$fromNat N.nat1 :: Maybe (Fin N.Nat1)NothingSfin Convert to .finConvert from any  .Tfin All values. [minBound .. maxBound] won't work for J &.universe :: [Fin N.Nat3][0,1,2]UfinLike T but ."universe1 :: NonEmpty (Fin N.Nat3) 0 :| [1,2]VfinT! which will be fully inlined, if n is known at compile time.inlineUniverse :: [Fin N.Nat3][0,1,2]Wfin(inlineUniverse1 :: NonEmpty (Fin N.Nat3) 0 :| [1,2]XfinJ & is inhabited.YfinCounting to one is boring.boring0\fin Append two J s together.6append (Left fin2 :: Either (Fin N.Nat5) (Fin N.Nat4))27append (Right fin2 :: Either (Fin N.Nat5) (Fin N.Nat4))7]fin Inverse of \..split fin2 :: Either (Fin N.Nat2) (Fin N.Nat3)Right 0.split fin1 :: Either (Fin N.Nat2) (Fin N.Nat3)Left 18map split universe :: [Either (Fin N.Nat2) (Fin N.Nat3)]'[Left 0,Left 1,Right 0,Right 1,Right 2]kfin works only on J n where n is prime.mfinOperations module n.3map fromInteger [0, 1, 2, 3, 4, -5] :: [Fin N.Nat3] [0,1,2,0,1,1]fromInteger 42 :: Fin N.Nat0*** Exception: divide by zero...signum (Z :: Fin N.Nat1)0signum (3 :: Fin N.Nat4)12 + 3 :: Fin N.Nat412 * 3 :: Fin N.Nat42nfinJ is printed as .To see explicit structure, use N or OJLKMNOPQRSTUVWXYZ[\]^_`abcdefgJLKPNOQRSMTVUWXYZ[\]^_`abcdefgNone,-.8=>?@ACHUVXQrfin'Constraint for the class that computes z.sfin'Constraint for the class that computes y.tfinCompute the size from the type.ufinGeneric enumerations. Examples:from ()0 to 0 :: ()() to 0 :: BoolFalsemap to F.universe :: [Bool] [False,True]Qmap (to . (+1) . from) [LT, EQ, GT] :: [Ordering] -- Num Fin is modulo arithmetic [EQ,GT,LT]vfinThe size of an enumeration.wfinConverts a value to its index.xfin*Converts from index to the original value.yfinGeneric version of w.zfinGeneric version of x.fin ~ +fin ~ 3fin ~ 2fin() ~ 1finVoid ~ 0 rstuvwxyz uvwxyszrt      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR  S  TUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ fin-0.0.2-2B9C2iBZrSAE7MRbTaclnYData.FinData.Nat Data.Type.Nat Data.Fin.Enum GHC.TypeLitsNatbaseGHC.Real toIntegerZS explicitShowexplicitShowsPreccata toNatural fromNaturalnat0nat1nat2nat3nat4nat5nat6nat7nat8nat9 $fHashableNat $fNFDataNat $fEnumNat $fIntegralNat $fRealNat$fNumNat $fShowNat$fEqNat$fOrdNat $fDataNatNat9Nat8Nat7Nat6Nat5Nat4Nat3Nat2Nat1Nat0MultPlusFromGHCToGHCInlineInductioninlineInduction1EqNatSNatIsnatSNatSZSSreflect reflectToNumreify snatToNat snatToNaturaleqNat induction1 inductioninlineInduction unfoldedFixproofPlusZeroNproofPlusNZeroproofMultZeroNproofMultNZero proofMultOneN proofMultNOne$fTestEqualityNatSNat$fSNatIS$fSNatIZ$fInlineInductionS$fInlineInductionZ $fShowTagged $fShowSNatFininversetoNatfromNatuniverse universe1inlineUniverseinlineUniverse1absurdboring weakenLeft weakenRightappendsplitfin0fin1fin2fin3fin4fin5fin6fin7fin8fin9 $fHashableFin $fNFDataFin $fEnumFin $fIntegralFin $fRealFin$fNumFin $fShowFin $fBoundedFin$fOrdFin$fEqFinGToGFrom GEnumSizeEnumEnumSizefromtogfromgto $fGFromRepU1 $fGFromRepV1 $fGFromRepM1 $fGFromRep:+: $fGToRepU1 $fGToRepV1 $fGToRepM1 $fGToRep:+: $fEnumEither$fEnumOrdering $fEnumBool$fEnum() $fEnumVoidGHC.Showshow showsPrec GHC.NaturalNaturalghc-prim GHC.TypesData.Type.Equality==GHC.NumNum Data.ProxyProxy unsafeFromNum GHC.ClassesOrdGHC.BaseNonEmptyquot Data.EitherEitherOrderingBool