h*hcR      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~1.5.0.0Textual Type Classes'Copyright (c) 2019-2025 Travis CardwellMIT Safe-Inferred "=`ttcThe " type class provides some default  instances.The  instance parses using the : instance. This instance was added in version 1.5.0.0.The * instance parses single-character strings.+Numeric type instances all parse using the  instance.Textual data type instances all convert from the source textual data type.ttc*Parse a data type from a textual data typettc*Parse a data type from a textual data typeUnlike , 1 allows you to specify meaningful error messages.When defining an instance, first convert the textual data type to the textual data type that is most natural for the data type. The as functions (such as ) provide a convenient way to do this. Note that error is also a textual data type. The / and 98 functions can be used to reduce boilerplate. Example: newtype Username = Username { usernameText :: Text } instance TTC.Parse Username where parse = TTC.asT $ t -> TTC.prefixErrorS "invalid username: " $ do unless (T.all isAsciiLower t) $ Left "not only lowercase ASCII letters" let len = T.length t when (len < 3) $ Left "fewer than 3 characters" when (len > 12) $ Left "more than 12 characters" pure $ Username t To use parse6 in a context where the types are ambiguous, use the  https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/type_applications.htmlTypeApplications7 GHC extension to specify one or more types. Example: -- Parse from Text parse _ -Text foo -- Parse using String errors parse _ _ 9String foo -- Parse from Text using String errors parse _ Text  String foo Alternatively, use one of the functions that parse from a specific textual data type (such as &). Using these functions may make code easier to understand even in cases where the types are not ambiguous.See the uname and prompt example programs in the  ttc-examples% directory of the source repository..For more details, see the following article: https://www.extrema.is/articles/ttc-textual-type-classes/render-and-parseSince a type may have at most one instance of a given type class, special care must be taken when defining type class instances in a shared library. In particular, orphan instances should generally not be used in shared libraries since they prevent users of the libraries from writing their own instances. Use newtype wrappers instead.'There are no default instances for the  type class, so that all instances can be customized per project when desired. Instances for some basic data types are defined for the  type class, however, and the Template Haskell functions documented below can be used to load these definitions with minimal boilerplate.ttc*Parse a data type from a textual data typettcDefault  instances for some common typesThe  instance renders using the : instance. This instance was added in version 1.5.0.0.The , instance renders a single-character string.,Numeric type instances all render using the  instance.Textual data type instances all convert to the target textual data type.ttc)Render a data type as a textual data typettc)Render a data type as a textual data typeUse & in your business logic, and only use  for debugging, as use of 8 instances in business logic is a common source of bugs.When defining an instance, render to the textual data type that is most natural for the data type, and then use  to handle the conversion to any textual data type. This is particularly wrappers around a textual data type. Example: newtype Username = Username { usernameText :: Text } instance TTC.Render Username where render = TTC.convert . usernameText To use render6 in a context where the types are ambiguous, use the  https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/type_applications.htmlTypeApplications7 GHC extension to specify one or both types. Example: -- Render to Text render _  Text foo Alternatively, use one of the functions that render to a specific textual data type (such as &). Using these functions may make code easier to understand even in cases where the types are not ambiguous.See the uname and prompt example programs in the  ttc-examples% directory of the source repository..For more details, see the following article: https://www.extrema.is/articles/ttc-textual-type-classes/render-and-parseSince a type may have at most one instance of a given type class, special care must be taken when defining type class instances in a shared library. In particular, orphan instances should generally not be used in shared libraries since they prevent users of the libraries from writing their own instances. Use newtype wrappers instead.'There are no default instances for the  type class, so that all instances can be customized per project when desired. Instances for some basic data types are defined for the  type class, however, and the Template Haskell functions documented below can be used to load these definitions with minimal boilerplate.ttc)Render a data type as a textual data typettc-Convert from one textual data type to another/The following textual data types are supported:  (S)Strict  (T)Lazy  (TL)Text  (TLB) (ST)Strict  (BS)Lazy  (BSL) ByteString  (BSB) (SBS)Note that support for additional textual data types cannot be implemented by writing instances. Adding support for additional textual data types requires changing the class definition itself. If you need support for additional textual data types, consider using the  7https://github.com/ExtremaIS/ttc-haskell/tree/main/ettcETTC library instead.Encoded values are assumed to be valid UTF-8 encoded text. Conversions must be pure, and any invalid bytes must be replaced with the Unicode replacement character U+FFFD. In cases where different behavior is required, process encoded values separately..For more details, see the following article: https://www.extrema.is/articles/ttc-textual-type-classes/textual-type-class ttc&Convert from a textual data type to a  ttc+Convert from a textual data type to strict  ttc)Convert from a textual data type to lazy  ttc&Convert from a textual data type to a Text  ttc$Convert from a textual data type to ttc-Convert from a textual data type to a strict ttc+Convert from a textual data type to a lazy ttc&Convert from a textual data type to a  ByteString ttc&Convert from a textual data type to a ttc-Convert from one textual data type to anotherttc-Convert from one textual data type to another?The order of the type arguments was changed in version 1.5.0.0.ttcConvert from a  to a textual data typettcConvert from strict  to a textual data typettcConvert from lazy  to a textual data typettcConvert from a Text  to a textual data typettcConvert from a  to a textual data typettcConvert from a strict  to a textual data typettcConvert from a lazy  to a textual data typettcConvert from a  ByteString  to a textual data typettcConvert from a  to a textual data typettc*Convert a textual data type argument to a ttc/Convert a textual data type argument to strict ttc-Convert a textual data type argument to lazy ttc*Convert a textual data type argument to a Text  ttc*Convert a textual data type argument to a !ttc1Convert a textual data type argument to a strict "ttc/Convert a textual data type argument to a lazy #ttc*Convert a textual data type argument to a  ByteString $ttc*Convert a textual data type argument to a %ttc.Render a value to a textual data type using a  instanceTo use this function in a context where the types are ambiguous, use the  https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/type_applications.htmlTypeApplications7 GHC extension to specify one or both types. Example: +-- Render to Text renderWithShow @Text foo See the enum example program in the  ttc-examples% directory of the source repository.&ttc Render to a 'ttcRender to strict (ttcRender to lazy )ttc Render to a Text *ttc Render to a +ttcRender to a strict ,ttcRender to a lazy -ttc Render to a  ByteString .ttc Render to a /ttc Create a  result from a  error message and a  value0ttc Create a  result from a  error message and a  value1ttc Create a  result from a  error message and a  value2ttc Create a  result from a  error message and a  value3ttc Create a  result from a  error message and a  value4ttc Create a  result from a  error message and a  value5ttc Create a  result from a  error message and a  value6ttc Create a  result from a  error message and a  value7ttc Create a  result from a  error message and a  value8ttc Create a  result from a  error message and a  value9ttcAdd a prefix to  error messages of a  result:ttcAdd a prefix to  error messages of a  result;ttcAdd a prefix to  error messages of a  result<ttcAdd a prefix to  error messages of a  result=ttcAdd a prefix to  error messages of a  result>ttcAdd a prefix to  error messages of a  result?ttcAdd a prefix to  error messages of a  result@ttcAdd a prefix to  error messages of a  resultAttcAdd a prefix to  error messages of a  resultBttcAdd a prefix to  error messages of a  resultCttcParse a value using a  instanceDttcParse a value using a % instance with default error messages0The following English error message is returned:%"invalid {name}" when the parse failsEttcParse a value to a  result using a  instanceFttcParse a value in an enumerationThe 6 instance determines the textual values to parse from.This function is intended to be used with types that have few choices, as the implementation uses a linear algorithm.See the enum example program in the  ttc-examples% directory of the source repository.Gttc String -> THS.Code m a The type of this function in previous versions of GHC is as follows: valid :: (Parse a, THS.Lift a) => String -> TH.Q (TH.TExp a) This function is used the same way in all GHC versions. See the valid and invalid example programs in the  ttc-examples directory of the source repository. The following is example usage from the valid example: 2sample :: Username sample = $$(TTC.valid "tcard") rttc,Validate a constant at compile-time using a  instanceThis function requires a  of the result type. Use s to avoid having to pass a  during constant definition.This function parses the  at compile-time and fails compilation on error. When valid, the  is compiled in, to be parsed again at run-time. Since the result is not compiled in, no  instance is required.This function uses a Template Haskell typed expression. Typed expressions were not supported in haskell-src-exts <1.22.0., which causes problems with old versions of hlint". If the issue affects you, use hlint -i "Parse error" to ignore parse errors or use t instead.Note that the typed Template Haskell API changed in GHC 9. The type displayed in this documentation is determined by the version of GHC used to build the documentation.:The type of this function in GHC 9 or later is as follows: validOf :: (MonadFail m, THS.Quote m, Parse a) => Proxy a -> String -> THS.Code m a The type of this function in previous versions of GHC is as follows: validOf :: Parse a => Proxy a -> String -> TH.Q (TH.TExp a) This function is used the same way in all GHC versions. See the validof example program in the  ttc-examples directory of the source repository. The following is example usage from the validof example: sample :: Username sample = $$(TTC.validOf (Proxy :: Proxy Username) "tcard") sttcMake a valid function using r for the given type Create a valid: function for a type in order to avoid having to write a  when defining constants.This function uses a Template Haskell typed expression. Typed expressions were not supported in haskell-src-exts <1.22.0., which causes problems with old versions of hlint". If the issue affects you, use hlint -i "Parse error" to ignore parse errors or use u instead.Note that the typed Template Haskell API changed in GHC 9. The type displayed in this documentation is determined by the version of GHC used to build the documentation.The type of the created valid* function in GHC 9 or later is as follows: $funName :: forall m. (MonadFail m, THS.Quote m) => String -> THS.Code m $resultType The type of the created valid5 function in previous versions of GHC is as follows: 5$funName :: String -> TH.Q (TH.TExp $resultType) This function is used the same way in all GHC versions. See the mkvalid example program in the  ttc-examples directory of the source repository. The following is example usage from the mkvalid example: "$(TTC.mkValid "valid" ''Username)  The created valid& function can then be used as follows: 7sample :: Username sample = $$(Username.valid "tcard") tttc,Validate a constant at compile-time using a  instanceThis function requires a  of the result type. Use u to avoid having to pass a  during constant definition.This function parses the  at compile-time and fails compilation on error. When valid, the  is compiled in, to be parsed again at run-time. Since the result is not compiled in, no  instance is required.See the uvalidof example program in the  ttc-examples directory of the source repository. The following is example usage from the uvalidof example: sample :: Username sample = $(TTC.untypedValidOf (Proxy :: Proxy Username) "tcard") uttcMake a valid function using t for the given type Create a valid: function for a type in order to avoid having to write a  when defining constants.See the mkuvalid example program in the  ttc-examples directory of the source repository. The following is example usage from the mkuvalid example: )$(TTC.mkUntypedValid "valid" ''Username)  The created valid& function can then be used as follows: 6sample :: Username sample = $(Username.valid "tcard") vttcMake a valid quasi-quoter using t for the given typeSee the  mkuvalidqq example program in the  ttc-examples directory of the source repository. The following is example usage from the  mkuvalidqq example: +$(TTC.mkUntypedValidQQ "valid" ''Username)  The created valid& function can then be used as follows: 4sample :: Username sample = [Username.valid|tcard|] wttcLoad the default  instance for a typeExample:  TTC.defaultRenderInstance ''Int xttcLoad the default " instances for any number of typesExample: TTC.defaultRenderInstances [''Int, ''Int8, ''Int16, ''Int32, ''Int64] yttcLoad the default  instance for a typeExample: TTC.defaultParseInstance ''Int zttcLoad the default " instances for any number of typesExample: TTC.defaultParseInstances [''Int, ''Int8, ''Int16, ''Int32, ''Int64] {ttcLoad the default  and  instance for a typeExample: (TTC.defaultRenderAndParseInstance ''Int |ttcLoad the default  and " instances for any number of typesExample: TTC.defaultRenderAndParseInstances [''Int, ''Int8, ''Int16, ''Int32, ''Int64] ttcThis instance enables use of q without having to type valid. The  https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/overloaded_strings.htmlOverloadedStrings extension must be enabled in the module where this functionality is used. Note that this reduces the number of characters in the code, but it can also make the code more difficult to understand by somebody who is not already familiar with it. Typing valid gives people a way to investigate and understand what is going on.Note that the typed Template Haskell API changed in GHC 9. The type displayed in this documentation is determined by the version of GHC used to build the documentation.:The type of this instance in GHC 9 or later is as follows: (MonadFail m, THS.Quote m, Parse a, THS.Lift a) => IsString (THS.Code m a) The type of this instance in previous versions of GHC is as follows: 5(Parse a, THS.Lift a) => IsString (TH.Q (TH.TExp a)) This functionality can be used as follows in all supported versions of GHC. The following is example usage from the valid example: *sample2 :: Username sample2 = $$("alice") The parenthesis are not required from GHC 9. The following is example usage from the valid example: (sample2 :: Username sample2 = $$"alice" Cttcinvalid input errorttctextual input to parsettcerror or parsed valueDttc!name to include in error messagesttctextual input to parsettcerror or parsed valueEttctextual input to parsettcparsed value or  if invalidFttccase-insensitive when ttcaccept unique prefixes when ttcinvalid input errorttcambiguous input errorttctextual input to parsettcerror or parsed valueGttc!name to include in error messagesttccase-insensitive when ttcaccept unique prefixes when ttctextual input to parsettcerror or parsed valuepttccase-insensitive when ttcaccept unique prefixes when   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|TTC wrapper types'Copyright (c) 2019-2025 Travis CardwellMIT Safe-Inferred"b ttc wrapper typettc ByteString  wrapper typettcLazy  wrapper typettcStrict  wrapper typettc wrapper typettcText  wrapper typettcLazy  wrapper typettcStrict  wrapper typettc wrapper type      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"ttc-1.5.0.0-IMwqMdFP0wr40AreZDnTrwData.TTCData.TTC.Wrapperttc ParseDefault parseDefaultParseparse RenderDefault renderDefaultRenderrenderTextualtoStoTtoTLtoTLBtoSTtoBStoBSLtoBSBtoSBSconvertfromSfromTfromTLfromTLBfromSTfromBSfromBSLfromBSBfromSBSasSasTasTLasTLBasSTasBSasBSLasBSBasSBSrenderWithShowrenderSrenderTrenderTL renderTLBrenderSTrenderBS renderBSL renderBSB renderSBS withError withErrorS withErrorT withErrorTL withErrorTLB withErrorST withErrorBS withErrorBSL withErrorBSB withErrorSBS prefixError prefixErrorS prefixErrorT prefixErrorTLprefixErrorTLB prefixErrorST prefixErrorBSprefixErrorBSLprefixErrorBSBprefixErrorSBS parseWithReadparseWithRead'maybeParseWithRead parseEnum parseEnum'parseSparseTparseTLparseTLBparseSTparseBSparseBSLparseBSBparseSBS parseMaybe parseMaybeS parseMaybeT parseMaybeTL parseMaybeTLB parseMaybeST parseMaybeBS parseMaybeBSL parseMaybeBSB parseMaybeSBS parseOrFail parseOrFailS parseOrFailT parseOrFailTLparseOrFailTLB parseOrFailST parseOrFailBSparseOrFailBSLparseOrFailBSBparseOrFailSBS parseUnsafe parseUnsafeS parseUnsafeT parseUnsafeTLparseUnsafeTLB parseUnsafeST parseUnsafeBSparseUnsafeBSLparseUnsafeBSBparseUnsafeSBSreadsWithParse readsEnumvalidvalidOfmkValiduntypedValidOfmkUntypedValidmkUntypedValidQQdefaultRenderInstancedefaultRenderInstancesdefaultParseInstancedefaultParseInstancesdefaultRenderAndParseInstancedefaultRenderAndParseInstances$fTextualShortByteString$fTextualBuilder$fTextualByteString$fTextualByteString0$fTextualShortText$fTextualBuilder0 $fTextualText$fTextualText0 $fTextualList$fRenderDefaultShortByteString$fRenderDefaultBuilder$fRenderDefaultByteString$fRenderDefaultByteString0$fRenderDefaultShortText$fRenderDefaultBuilder0$fRenderDefaultText$fRenderDefaultText0$fRenderDefaultList$fRenderDefaultWord64$fRenderDefaultWord32$fRenderDefaultWord16$fRenderDefaultWord8$fRenderDefaultWord$fRenderDefaultInt64$fRenderDefaultInt32$fRenderDefaultInt16$fRenderDefaultInt8$fRenderDefaultInt$fRenderDefaultInteger$fRenderDefaultFloat$fRenderDefaultDouble$fRenderDefaultChar$fRenderDefaultBool$fParseDefaultShortByteString$fParseDefaultBuilder$fParseDefaultByteString$fParseDefaultByteString0$fParseDefaultShortText$fParseDefaultBuilder0$fParseDefaultText$fParseDefaultText0$fParseDefaultList$fParseDefaultWord64$fParseDefaultWord32$fParseDefaultWord16$fParseDefaultWord8$fParseDefaultWord$fParseDefaultInt64$fParseDefaultInt32$fParseDefaultInt16$fParseDefaultInt8$fParseDefaultInt$fParseDefaultInteger$fParseDefaultFloat$fParseDefaultDouble$fParseDefaultChar$fParseDefaultBool$fIsStringCode WrapperSBS unWrapperSBS WrapperBSB unWrapperBSB WrapperBSL unWrapperBSL WrapperBS unWrapperBS WrapperST unWrapperST WrapperTLB unWrapperTLB WrapperTL unWrapperTLWrapperT unWrapperTWrapperS unWrapperS$fRenderWrapperS$fParseWrapperS$fRenderWrapperT$fParseWrapperT$fRenderWrapperTL$fParseWrapperTL$fRenderWrapperTLB$fParseWrapperTLB$fRenderWrapperST$fParseWrapperST$fRenderWrapperBS$fParseWrapperBS$fRenderWrapperBSL$fParseWrapperBSL$fRenderWrapperBSB$fParseWrapperBSB$fRenderWrapperSBS$fParseWrapperSBSghc-prim GHC.TypesBoolbaseGHC.ReadReadCharGHC.ShowShowGHC.BaseString!text-2.1.2-HpFCCJ7g1i1EgIdwpKMF9rData.Text.InternalTextData.Text.Internal.LazyData.Text.Internal.BuilderBuilder'text-short-0.1.6-LpYDzMmrwZTDCn3hcryAJ5Data.Text.Short.Internal ShortText*bytestring-0.12.2.0-DYd1yUTywj4J0IGT3WPznuData.ByteString.Internal.Type ByteStringData.ByteString.Lazy.Internal Data.ByteString.Builder.InternalData.ByteString.Short.InternalShortByteStringconvert' GHC.MaybeMaybeControl.Monad.Fail MonadFailText.ParserCombinators.ReadPReadStemplate-haskellLanguage.Haskell.TH.SyntaxLift Data.ProxyProxyNothingTrue