@@ -1,9 +1,9 @@
1module Data.Index
1module Data.Index
2 ( ZeroBased
2 ( ZeroBased
7 , toOneBased
7 , toOneBased
8 , indexedMap
8 , indexedMap
9 , indexedTraverse
9 , indexedTraverse
@@ -32,14 +32,12 @@ first =
32 ZeroBased 0
32 ZeroBased 0
35−second :: ZeroBased
35+unsafe :: Int -> ZeroBased
37− ZeroBased 1
37+ if n < 0 then
40−third :: ZeroBased
40+ error "Compiler error, unacceptable call of Index.unsafe"
45{-# INLINE next #-}
43{-# INLINE next #-}
@@ -49,7 +47,12 @@ next (ZeroBased i) =
52−-- ONE BASED
50+-- DESTRUCT
53+toZeroBased :: ZeroBased -> Int
54+toZeroBased (ZeroBased index) =
55toOneBased :: ZeroBased -> Int
58toOneBased :: ZeroBased -> Int
@@ -124,3 +127,4 @@ indexedZipWithA func listX listY =
124instance Binary ZeroBased where
127instance Binary ZeroBased where
125 get = liftM ZeroBased get
128 get = liftM ZeroBased get
126 put (ZeroBased n) = put n
129 put (ZeroBased n) = put n