44toOneBased :: ZeroBased -> Int
45toOneBased (ZeroBased index) =
53{-# INLINE indexedMap #-}
54indexedMap :: (ZeroBased -> a -> b) -> [a] -> [b]
56 zipWith func (map ZeroBased [0 .. length list]) list
59{-# INLINE indexedTraverse #-}
60indexedTraverse :: (Applicative f) => (ZeroBased -> a -> f b) -> [a] -> f [b]
61indexedTraverse func list =
62 sequenceA (indexedMap func list)
66-- VERIFIED/INDEXED ZIP
71 | LengthMismatch Int Int
74indexedZipWith :: (ZeroBased -> a -> b -> c) -> [a] -> [b] -> VerifiedList c
75indexedZipWith func listX listY =
76 indexedZipWithHelp func 0 listX listY []
79indexedZipWithHelp :: (ZeroBased -> a -> b -> c) -> Int -> [a] -> [b] -> [c] -> VerifiedList c
80indexedZipWithHelp func index listX listY revListZ =
81 case (listX, listY) of
83 LengthMatch (reverse revListZ)
86 indexedZipWithHelp func (index + 1) xs ys $
87 func (ZeroBased index) x y : revListZ
90 LengthMismatch (index + length listX) (index + length listY)
93indexedZipWithA :: (Applicative f) => (ZeroBased -> a -> b -> f c) -> [a] -> [b] -> f (VerifiedList c)
94indexedZipWithA func listX listY =
95 case indexedZipWith func listX listY of
97 LengthMatch <$> sequenceA list
100 pure (LengthMismatch x y)
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