Aleksey Khudyakov avatar Aleksey Khudyakov committed e72e9ff

Remove ! operator

Comments (0)

Files changed (1)

Data/Vector/Fixed.hs

     -- ** Element access
   , head
   , tail
-  , (!)
     -- ** Comparison
   , eq
     -- ** Map
 
 ----------------------------------------------------------------
 
--- | /O(n)/ Get vector's element at index i.
-(!) :: (Vector v a) => v a -> Int -> a
-{-# INLINE (!) #-}
-v ! i = inspectV v
-      $ elemF i
-
-newtype T_Elem a n = T_Elem (Either Int a)
-
-elemF :: forall n a. Arity n => Int -> Fun n a a
-elemF n
-  -- This is needed because of possible underflow during subtraction
-  | n < 0     = error "Data.Vector.Fixed.!: index out of range"
-  | otherwise = Fun $ accum
-     (\(T_Elem x) a -> T_Elem $ case x of
-                         Left  0 -> Right a
-                         Left  i -> Left (i - 1)
-                         r       -> r
-     )
-     (\(T_Elem x) -> case x of
-                       Left  _ -> error "Data.Vector.Fixed.!: index out of range"
-                       Right a -> a
-     )
-     ( T_Elem (Left n) :: T_Elem a n)
-
-
-----------------------------------------------------------------
-
 -- | Left fold over vector
 foldl :: Vector v a => (b -> a -> b) -> b -> v a -> b
 {-# INLINE foldl #-}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.