9data Mod2 : Nat -> Type where
10 MkMod2 : {n : Nat} -> Bits n -> Mod2 n
12modBin : (Bits n -> Bits n -> Bits n) -> Mod2 n -> Mod2 n -> Mod2 n
13modBin f (MkMod2 x) (MkMod2 y) = MkMod2 (f x y)
15modComp : (Bits n -> Bits n -> a) -> Mod2 n -> Mod2 n -> a
16modComp f (MkMod2 x) (MkMod2 y) = f x y
19div : Mod2 n -> Mod2 n -> Mod2 n
23rem : Mod2 n -> Mod2 n -> Mod2 n
28intToMod : {n : Nat} -> Integer -> Mod2 n
29intToMod {n=n} x = MkMod2 (intToBits x)
31instance Eq (Mod2 n) where
34instance Ord (Mod2 n) where
39 compare = modComp compare
41instance Num (Mod2 n) where
46 fromInteger = intToMod
48instance Cast (Mod2 n) (Bits n) where
51instance Cast (Bits n) (Mod2 n) where
54modToStr : Mod2 n -> String
55modToStr x = pack (reverse (helper x))
58 helper : Mod2 n -> List Char
59 helper x = strIndex "0123456789" (prim__truncBigInt_Int (bitsToInt (cast (x `rem` 10))))
60 :: (if x < 10 then [] else helper (x `div` 10))
63instance Show (Mod2 n) where
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list