10data Mod2 : Nat -> Type where
11 MkMod2 : {n : Nat} -> Bits n -> Mod2 n
13modBin : (Bits n -> Bits n -> Bits n) -> Mod2 n -> Mod2 n -> Mod2 n
14modBin f (MkMod2 x) (MkMod2 y) = MkMod2 (f x y)
16modComp : (Bits n -> Bits n -> a) -> Mod2 n -> Mod2 n -> a
17modComp f (MkMod2 x) (MkMod2 y) = f x y
20div : Mod2 n -> Mod2 n -> Mod2 n
24rem : Mod2 n -> Mod2 n -> Mod2 n
29intToMod : {n : Nat} -> Int -> Mod2 n
30intToMod {n=n} x = MkMod2 (intToBits x)
32instance Eq (Mod2 n) where
35instance Ord (Mod2 n) where
40 compare = modComp compare
42instance Num (Mod2 n) where
47 fromInteger = intToMod
49instance Cast (Mod2 n) (Bits n) where
52instance Cast (Bits n) (Mod2 n) where
55modToStr : Mod2 n -> String
56modToStr x = pack (reverse (helper x))
59 helper : Mod2 n -> List Char
60 helper x = strIndex "0123456789" (bitsToInt (cast (x `rem` 10)))
61 :: (if x < 10 then [] else helper (x `div` 10))
64instance 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