Permalink
Browse files

Improve documentation for index

  • Loading branch information...
1 parent 3a07917 commit 70e7a8a73a3a4302833b89561211a18e2b5ab44d @tibbe tibbe committed Nov 21, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 Data/Csv/Conversion.hs
View
6 Data/Csv/Conversion.hs
@@ -615,8 +615,10 @@ typeError typ s mmsg =
-- 'empty' if the value cannot be converted to the desired type.
-- Raises an exception if the index is out of bounds.
--
--- If you're certain that the index is not out of bounds, using
--- @'parseField' (`V.unsafeIndex` v idx)@ is somewhat faster.
+-- 'index' is a simple convenience function that is equivalent to
+-- @'parseField' (v '!' idx)@. If you're certain that the index is not
+-- out of bounds, using @'parseField' (`V.unsafeIndex` v idx)@ is
+-- somewhat faster.
index :: FromField a => Record -> Int -> Parser a
index v idx = parseField (v ! idx)
{-# INLINE index #-}

0 comments on commit 70e7a8a

Please sign in to comment.