!9      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                          !"#$%&'()*+,-./012345678(C) CSIRO 2017-2018BSD3-George Wilson <george.wilson@data61.csiro.au> experimental non-portableSafesvfactorClassy lens for svfactor Does the Sv have a Headern or not? A header is a row at the beginning of a file which contains the string names of each of the columns.IIf a header is present, it must not be decoded with the rest of the data.(C) CSIRO 2017-2018BSD3-George Wilson <george.wilson@data61.csiro.au> experimental non-portableNone3456K-4 svfactorDA function that, given a char, escapes all occurrences of that char. svfactorDA function that, given a char, escapes all occurrences of that char.This version allows the escaping to be type-changing. For example, escaping a single char can result in a string with two characters. svfactor9Wrapper for text that is known to be in an unescaped formsvfactorwReplaces all occurrences of the given character with two occurrences of that character, non-recursively, in the given 9.!escapeString ''' "hello 'string'""hello ''string''"svfactoreReplaces all occurrences of the given character with two occurrences of that character in the given : <{- LANGUAGE OverloadedStrings -} >>> escapeText ''' "hello text " "hello 'text'" svfactorReplaces all occurrences of the given character with two occurrences of that character in the given ByteString, which is assumed to be UTF-8 compatible. ;{- LANGUAGE OverloadedStrings -} >>> escapeUtf8 ''' "hello  bytestring " "hello ' bytestring'" svfactorReplaces all occurrences of the given character with two occurrences of that character in the given lazy ByteString, which is assumed to be UTF-8 compatible. o{- LANGUAGE OverloadedStrings -} >>> escapeUtf8Lazy ''' "hello 'lazy bytestring'" "hello ''lazy bytestring''" svfactor/Escape a character, which must return a string.escapeChar ''' '''"''"escapeChar ''' 'z'"z"  (C) CSIRO 2017-2018BSD3-George Wilson <george.wilson@data61.csiro.au> experimental non-portableNone;=>?A8F svfactorClassy optics for !!svfactor)Options to configure the printing process#svfactor.How do I convert these values into ByteString ;Gs? This depends not only on type, but on character encoding. Default: &$svfactor<How do I escape quotes which appear in this value? Default: %svfactorPrint options for Svs containing UTF-8 bytestrings&svfactorPrint options for Svs containing UTF-8 bytestrings'svfactorPrint options for Sv#s containing UTF-8 lazy bytestrings(svfactorPrint options for Sv s containing :)svfactorPrint options for Sv s containing 9s  !"#$%&'() !"#$ %&'()(C) CSIRO 2017-2018BSD3-George Wilson <george.wilson@data61.csiro.au> experimental non-portableSafe>}+svfactor+ is a classy prism for 00svfactor0 is a sum type for line endings1svfactor "\r"2svfactor "\n"3svfactor "\rn"4svfactor Convert a 0 to a 9. Since this uses <', it works for other data types, like : or .5svfactorTry to parse text into a 0 +,-./012345 0123+,-./45(C) CSIRO 2017-2018BSD3-George Wilson <george.wilson@data61.csiro.au> experimental non-portableSafe;=>?FTD<svfactorClassy prisms for @@svfactor@A sum type for quote characters. Either single or double quotes.Csvfactor*Convert a Quote to the Char it represents.Dsvfactor Convert a @ to a 9. Since this uses <', it works for other data types, like  or . <=>?@ABCD @AB<=>?CD(C) CSIRO 2017-2018BSD3-George Wilson <george.wilson@data61.csiro.au> experimental non-portableSafe 67;=>?AFTOKsvfactorClassy lens for MMsvfactor7By what are your values separated? The answer is often N, but not always.A M is just a =. It could be a sum type instead, since it will usually be comma or pipe, but our preference has been to be open here so that you can use whatever you'd like. There are test cases, for example, ensuring that you're free to use null-byte separated values if you so desire.Nsvfactor6The venerable comma separator. Used for CSV documents.Osvfactor+The pipe separator. Used for PSV documents.Psvfactor!Tab is a separator too - why not?KLMNOPMKLNOP(C) CSIRO 2017-2018BSD3-George Wilson <george.wilson@data61.csiro.au> experimental non-portableNone 67;=>?AFTaRsvfactorClassy lenses for WWsvfactorWI is a value with zero or many horizontal spaces around it on both sides.\svfactorHelpful alias for lists of bs]svfactorClassy prisms for asasvfactora is a subset of =(. To move back and forth betwen it and =, 9, or :, use ^dsvfactor One spaceesvfactorAs many spaces as you'd likefsvfactorOne tabgsvfactorTurn a b into a =. To go the other way, see hhsvfactorTry to turn a =( into a Space. To go the other way, see gisvfactorParse : into \, or turn spaces into :jsvfactorParse 9 into \ , or convert \ into 9ksvfactork is just the constructor for W= with a different argument order, which is sometimes useful.lsvfactorPlaces its argument in a W with no spaces.msvfactorm7 puts the same spacing both before and after something.nsvfactorRemove spaces from the argumenttsvfactor?Appends the right parameter on the inside of the left parameter SSpaced " " () " " *> Spaced "\t\t\t" () "\t \t" == Spaced " \t\t\t" () "\t \t "RSVUTWXYZ[\]^_`abcdefghijklmnabc]^_`\defghijWXYZ[RSVUTkmln(C) CSIRO 2017-2018BSD3-George Wilson <george.wilson@data61.csiro.au> experimental non-portableNone 6;=>?AFTl6svfactorClassy > for things containing ssvfactorClassy prisms for svfactor s are often surrounded by spacessvfactorA & is a single cell from a CSV document.Its value is either E, which indicates the type of quote surrounding the value, or it is , containing only the value.svfactor)Build a quoted field with a normal stringsvfactorThe catamorphism for Field'svfactorPLens into the contents of a Field, regardless of whether it's quoted or unquotedWXWX (C) CSIRO 2017-2018BSD3-George Wilson <george.wilson@data61.csiro.au> experimental non-portableNone6qsvfactorA non-empty value of ?svfactor Convert a @ list to a svfactor Convert a  to a @ listsvfactor Convert a  back to a ?svfactorGet or set the head of a svfactorGet or set the head of a  (C) CSIRO 2017-2018BSD3-George Wilson <george.wilson@data61.csiro.au> experimental non-portableNone6;=>?AKN svfactorClassy lenses for svfactor/A collection of records, separated by newlines.svfactorClassy lenses for svfactorA Record[ is a non-empty collection of Fields, implicitly separated by a separator (often a comma).svfactorA  is isomorphic to a @ list of ssvfactorBuild an empty record.According to RFC 4180, a record must have at least one field. But a field can be the empty string. So this is the closest we can get to an empty record.Note that this does not make  a A#. It is not a lawful unit for the B operation.svfactorBuild a  with just one svfactorBuild a  given a @ list of its fieldssvfactorPrism for an empty svfactorPrism for a non-empty svfactorConvenience constructor for .3This puts the same newline between all the records.svfactor(A record collection conaining one recordsvfactorCollect the list of s from anything that  (C) CSIRO 2017-2018BSD3-George Wilson <george.wilson@data61.csiro.au> experimental non-portableNone34567;=>?AFT svfactorClassy lenses for svfactorA } is present in many CSV documents, usually listing the names of the columns. We keep this separate from the regular records.svfactorClassy lenses for svfactor is a whitespace-preserving data type for separated values. Often the separator is a comma, but this type does not make that assumption so that it can be used for pipe- or tab-separated values as well.svfactorConvenience constructor for Svsvfactor An empty SvsvfactorDetermine the  of an svfactorUsed to build s that don't have a headersvfactorConvenience constructor for , usually when you're building s'KLMNOP'MKLNOP (C) CSIRO 2017-2018BSD3-George Wilson <george.wilson@data61.csiro.au> experimental non-portableNone 7;=>?AFTz svfactorClassy lenses for svfactorAn c informs the parser how to parse your file. The type parameter will be some sort of string; often .A default is provided as   , seen below.svfactor3Which separator does the file use? Usually this is N, but it can also be pipe, or any other = (M = =)svfactor7Whether there is a header row with column names or not. svfactorcIf a blank line is encountered, should the parse finish, or treat it as an empty row and continue? svfactorOHow should I turn a String into this type? This is a detail used by the parser. svfactor k is used to parse a CSV file featuring a header row, using Trifecta as the parsing library. It uses UTF-8 Cs svfactor!The default separator. Alias for N. svfactor(The default is that a header is present.KL       KL   (C) CSIRO 2017-2018BSD3-George Wilson <george.wilson@data61.csiro.au> experimental non-portableNoneGKLMNOPWX (C) CSIRO 2017-2018BSD3-George Wilson <george.wilson@data61.csiro.au> experimental non-portableNonePsvfactor Convert a 0 to a ByteString ;svfactor Convert a  to a ByteString ;svfactor Convert a  to a ByteString ;svfactor Convert a  to a ByteString ;svfactorConvert  to a ByteString ;.svfactorConvert  to a ByteString ;.(C) CSIRO 2017-2018BSD3-George Wilson <george.wilson@data61.csiro.au> experimental non-portableNonen Dsvfactor Converts an  to a ByteString ;@. Useful if you want to concatenate other text before or after.svfactor9Writes an sv to a file handle. This goes directly from a ;(, so it is more efficient than calling  or ' and writing the result to the handle.svfactor2Writes an sv to a file. This goes directly from a ;(, so it is more efficient than calling  or # and writing the result to a file.svfactor9Writes an sv to a file handle. This goes directly from a ;(, so it is more efficient than calling  or ' and writing the result to the handle.[This version is polymorphic, but as a penalty you have to tell me how to get a Bytestring ;.svfactor2Writes an sv to a file. This goes directly from a ;(, so it is more efficient than calling  or # and writing the result to a file.[This version is polymorphic, but as a penalty you have to tell me how to get a Bytestring ;.svfactorPrint an Sv to a C value.svfactorPrint an Sv to a lazy  value.svfactorConverts the given  into a strict CsvfactorConverts the given  into a lazy  svfactorPrint an Sv containing : to a C!svfactorPrint an Sv containing : to a  !"#$%&'() !  !(C) CSIRO 2017-2018BSD3-George Wilson <george.wilson@data61.csiro.au> experimental non-portableNoneɋ EsvfactorThis function is in newer versions of the parsers package, but in order to maintain compatibility with older versions I've left it here."svfactor)Parse a field surrounded by single quotes#svfactor)Parse a field surrounded by double quotesFsvfactorBGiven a quote, parse its escaped form (which is it repeated twice)$svfactor.Parse a field that is not surrounded by quotes%svfactor'Parse a field, be it quoted or unquoted&svfactor*Parse a field with its surrounding spacing'svfactor2Combinator to parse some data surrounded by spaces(svfactor Parse an entire record, or "row")svfactorParse many records, or "rows"*svfactorParse zero or many newlines+svfactorAMaybe parse the header row of a CSV file, depending on the given ,svfactor Parse an  "#$%&'()*+, ,+%"#$'&()*(C) CSIRO 2017-2018BSD3-George Wilson <george.wilson@data61.csiro.au> experimental non-portableNone -svfactor;Which parsing library should be used to parse the document?&The parser is written in terms of the parsersf library, meaning it can be instantiated to several different parsing libraries. By default, we use 5 , because  Text.Trifecta"s error messages are so helpful. 6J is faster though, if your input is ASCII and you care a lot about speed.It is worth noting that Trifecta assumes UTF-8 encoding of the input data. UTF-8 is backwards-compatible with 7-bit ASCII, so this will work for many documents. However, not all documents are ASCII or UTF-8. For example, our  ?https://github.com/qfpl/sv/blob/master/examples/csv/species.csv species.csv test file is Windows-1252, which is a non-ISO extension of latin1 8-bit ASCII. For documents encoded as Windows-1252, Trifecta's assumption is invalid and parse errors result.  Attoparsec works fine for this character encoding, but it wouldn't work well on a UTF-8 encoded document including non-ASCII characters.1svfactorParse a C as an Sv.HThis version uses Trifecta, hence it assumes its input is UTF-8 encoded.2svfactorParse some text as an Sv.KThis version lets you choose which parsing library to use by providing an -. Common selections are 5 and 6.3svfactorLoad a file and parse it as an .HThis version uses Trifecta, hence it assumes its input is UTF-8 encoded.4svfactorLoad a file and parse it as an .KThis version lets you choose which parsing library to use by providing an -. Common selections are 5 and 6.5svfactorAn - that uses  Text.TrifectaX. Trifecta assumes its input is UTF-8, and provides helpful clang-style error messages.6svfactorAn - that uses Data.Attoparsec.ByteString . This is the fastest provided -#, but it has poorer error messages.7svfactorAn - that uses Data.Attoparsec.Text3. This is helpful if your input is in the form of :.8svfactorHelper to convert  Text.Trifecta  to G.KL     ,-./012345678 1234,-./05867(C) CSIRO 2017-2018BSD3-George Wilson <george.wilson@data61.csiro.au> experimental non-portableNonex !"#$%&'()KLMNOPWX      !,-./012345678H !"#$%%&'()*+,-./0123456789::;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnoopqrstuvwxyz{|h}~                                                  ! " # $ % & '()*+,-./0123456k7899:;<=>?@ABCDEFGHIJKDLMNOPQRSTUVDEWDEXDEYIZ[\]D^_`#svfactor-0.1-GDLTyJD8FfREVKdyivwTvx"Data.Svfactor.Structure.HeadednessData.Svfactor.Text.EscapeData.Svfactor.Print.OptionsData.Svfactor.Text.NewlineData.Svfactor.Text.QuoteData.Svfactor.Text.SeparatorData.Svfactor.Text.SpaceData.Svfactor.Syntax.FieldData.Svfactor.Vector.NonEmptyData.Svfactor.Syntax.RecordData.Svfactor.Syntax.SvData.Svfactor.Parse.OptionsData.Svfactor.Print.InternalData.Svfactor.PrintData.Svfactor.Parse.InternalData.Svfactor.ParseData.ByteString ByteString Data.TextTextData.Svfactor.SyntaxData.ByteString.Lazy Text.TrifectaResult Data.Svfactor HasHeadedness headedness HeadednessUnheadedHeaded$fHasHeadednessHeadedness$fEqHeadedness$fOrdHeadedness$fShowHeadednessEscaper'Escaper UnescapedgetRawUnescaped escapeString escapeText escapeUtf8escapeUtf8Lazy escapeChar$fNFDataUnescaped $fEqUnescaped$fOrdUnescaped$fShowUnescaped$fSemigroupUnescaped$fMonoidUnescaped$fFunctorUnescaped$fFoldableUnescaped$fTraversableUnescaped$fGenericUnescapedHasPrintOptions printOptionsbuildescape PrintOptions_build_escapedefaultPrintOptionsutf8PrintOptionsutf8LazyPrintOptionstextPrintOptionsstringPrintOptions$fHasPrintOptionsPrintOptionsa AsNewline_Newline_CR_LF_CRLFNewlineCRLFCRLFnewlineToString parseNewline$fNFDataNewline$fAsNewlineText$fAsNewlineNewline $fEqNewline $fOrdNewline $fShowNewlineAsQuote_Quote _SingleQuote _DoubleQuoteQuote SingleQuote DoubleQuote quoteChar quoteToString $fNFDataQuote $fAsQuoteChar$fAsQuoteQuote $fEqQuote $fOrdQuote $fShowQuote HasSeparator separator Separatorcommapipetab$fHasSeparatorChar HasSpacedspacedafterbefore spacedValueSpaced_before_after_valueSpacesAsHorizontalSpace_HorizontalSpace_Space_TabHorizontalSpaceSpaceTabsingle manySpaces spaceToChar charToSpace spacesText spacesStringbetwixtunspaceduniform removeSpaces$fNFDataHorizontalSpace$fAsHorizontalSpaceChar"$fAsHorizontalSpaceHorizontalSpace$fTraversableSpaced$fFoldableSpaced$fApplicativeSpaced$fFunctorSpaced$fNFDataSpaced$fHasSpacedSpacedSpacedab$fEqHorizontalSpace$fOrdHorizontalSpace$fShowHorizontalSpace $fEqSpaced $fOrdSpaced $fShowSpaced$fGenericSpaced HasFieldsfieldsAsField_Field _Unquoted_Quoted SpacedFieldFieldUnquotedQuotedunescapedField foldField fieldContents$fTraversableField$fFoldableField$fFunctorField $fNFDataField$fHasFieldsFieldFieldst$fAsFieldFielda $fEqField $fOrdField $fShowField$fGenericFieldNonEmptyVectorfromNeltoNeltoVectorheadNevtailNev$fSemigroupNonEmptyVector$fTraversable1NonEmptyVector$fTraversableNonEmptyVector$fFoldable1NonEmptyVector$fFoldableNonEmptyVector$fApplicativeNonEmptyVector$fApplyNonEmptyVector$fFunctorNonEmptyVector$fNFDataNonEmptyVector$fEqNonEmptyVector$fOrdNonEmptyVector$fShowNonEmptyVector$fGenericNonEmptyVector HasRecordsrecordstraverseRecordstraverseNewlinesRecords EmptyRecords HasRecordrecord spacedFieldsRecord_fieldsrecordSpacedFieldsIso emptyRecord singleField recordNel _EmptyRecords_NonEmptyRecords mkRecords singleRecord recordList$fTraversableRecord$fFoldableRecord$fFunctorRecord$fNFDataRecord$fHasFieldsRecordRecordab$fHasRecordRecordRecordab$fTraversableRecords$fFoldableRecords$fFunctorRecords$fNFDataRecords$fHasRecordsRecordss $fEqRecord $fOrdRecord $fShowRecord$fSemigroupRecord$fGenericRecord $fEqRecords $fOrdRecords $fShowRecords$fGenericRecords HasHeaderheader headerNewline headerRecordHeader _headerRecordHasSvsv maybeHeadertraverseHeader finalNewlinesSv _separatorSv _maybeHeader_records_finalNewlinesmkSvemptySv getHeadednessnoHeadermkHeader$fNFDataHeader$fHasSeparatorSv$fTraversableSv $fFoldableSv $fFunctorSv$fHasRecordsSvs $fNFDataSv $fHasSvSvs$fHasFieldsHeaderHeaderab$fHasRecordHeaderHeaderab$fHasHeaderHeaderHeaderab $fEqHeader $fOrdHeader $fShowHeader$fFunctorHeader$fFoldableHeader$fTraversableHeader$fGenericHeader$fEqSv$fOrdSv$fShowSv $fGenericSvHasParseOptions parseOptions encodeStringendOnBlankLine ParseOptions_parseSeparator _headedness_endOnBlankLine _encodeStringdefaultParseOptionsdefaultSeparatordefaultHeadedness$fHasHeadednessParseOptions$fHasSeparatorParseOptions$fFunctorParseOptions+$fHasParseOptionsParseOptionsParseOptionsab printNewline printField printSpaced printRecord printRecords printHeaderwriteSvToHandle writeSvToFilewriteSvToHandle'writeSvToFile'printSv printSvLazyprintSv' printSvLazy' printSvTextprintSvTextLazysingleQuotedFielddoubleQuotedField unquotedFieldfield spacedFieldendingseparatedValuesSvParser runSvParserrunSvParserFromFileparseSvparseSv'parseSvFromFileparseSvFromFile'trifectaattoparsecByteStringattoparsecTexttrifectaResultToEitherbaseGHC.BaseString text-1.2.3.0Data.Text.Internalbytestring-0.10.8.2 Data.ByteString.Builder.InternalBuilder Data.StringIsStringghc-prim GHC.TypesChar lens-4.17-628bk3VBrYQ7Vqh3Mqjes7Control.Lens.Type Traversal&vector-0.12.0.1-GC2xzdMF0QQGz7ZCcRBJRL Data.VectorVectorNonEmptyMonoid SemigroupData.ByteString.Internal svToBuildersepEndByNonEmpty escapeQuote Data.EitherEither