-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Auto-generation of records data type.
--   
--   cassava-records library helps in auto-creating record data types using
--   Template Haskell by inferring types from the columns of a csv or
--   compatible input file. The record and type classes instances generated
--   can be seamlessly used with cassava(the haskell csv reader library) to
--   load the data into these record types without dealing with any other
--   level of abstraction. Please see README on Github at
--   <a>https://github.com/gdevanla/cassava-records#readme</a>
@package cassava-records
@version 0.1.0.4


-- | This module provides an easy way to explore input files that may have
--   numerous columns by helping create a Record types by guessing the
--   types. That information can be used as is or persisted to a file so
--   that other customizations can be performed.
module Data.Cassava.Internal.RecordBuilder

-- | Create a field name and type tuple that will be used with RecC to
--   create a Record.
makeField :: ByteString -> Type -> String -> (Name, Bang, Type)
makeFields :: Vector (ByteString, Type) -> String -> Vector (Name, Bang, Type)
makeRecord :: String -> Vector (Name, Bang, Type) -> DecsQ
createRecords :: ByteString -> DecodeOptions -> (Header, Vector NamedRecord)
inferColumnType :: ByteString -> Vector ByteString -> (ByteString, Type)
isInteger :: String -> Bool
isDouble :: String -> Bool
isNumeric :: String -> Bool
isBool :: String -> Bool

-- | Instances to support conversion to Bool type. Cassava currently does
--   not provide an instance for Bool.

-- | Instances to support creation of Bool type fields. Cassava currently
--   does not provide an instance for Bool.
data Empty
Empty :: Empty
maybeType :: Name -> Type
inferMajorityType :: Vector ByteString -> Type
collectColumns :: ByteString -> Vector NamedRecord -> Vector ByteString
inferTypes :: Header -> Vector NamedRecord -> String -> Vector (Name, Bang, Type)
instance Data.Csv.Conversion.ToField GHC.Types.Bool
instance Data.Csv.Conversion.FromField GHC.Types.Bool


-- | This module provides an easy way to explore input files that may have
--   numerous columns by helping create a Record types by guessing the
--   types. That information can be used as is or persisted to a file so
--   that other customizations can be performed.
module Data.Cassava.Records

-- | Makes the Record that reflects the types inferred from the input file.
makeCsvRecord :: String -> FilePath -> String -> DecodeOptions -> DecsQ

-- | Provides a default <a>DecodeOptions</a> for comma separated input
--   files
commaOptions :: DecodeOptions

-- | Provides a default <a>DecodeOptions</a> for tab separated input files
tabOptions :: DecodeOptions

-- | Convinience method that creates the default instances required by
--   Cassava. The generated methods assumed fields are prefixed with "_".
--   
--   For example, if the column header in the input file have upper case or
--   mixed case the names will not directly match with field names in the
--   record. In that case explicity instances have to be provided manually
--   and the field modifiers provided accordingly.
--   
--   For example, if the columns in the input file have all headers listed
--   in upper case, since the field names are all lower case, the
--   defaultFieldNameOptions function would look like this
--   
--   <pre>
--   defaultFieldNameOptions :: Options
--   defaultFieldNameOptions = defaultOptions { fieldLabelModifier = rmUnderscore }
--     where
--       rmUnderscore ('_':str) = DT.unpack . DT.toUpper . DT.pack $ str
--       rmUnderscore str = str
--   </pre>
--   
--   Note the DT.toUpper call to convert the field names to upper case
--   before comparing to <tt>NamedRecords</tt>
makeInstance :: String -> DecsQ

-- | Helper function to load the data from the the provided file path
loadData :: (FromNamedRecord a) => FilePath -> IO (Vector a)
