{-# LANGUAGE MultiParamTypeClasses
, TypeSynonymInstances
, FlexibleInstances
#-}moduleData.ByteString.Nums.Careless.FloatwhereimportData.CharimportPreludehiding(break,length,null,drop,tail,head)importData.ByteStringhiding(head,break,pack)importData.ByteString.Char8hiding(inits,elem,last,foldl')importqualifiedData.ByteString.Lazy.InternalasLazyimportqualifiedData.ByteString.Lazy.Char8asLazyimportData.ByteString.Nums.Careless.Int{-| Types that can be read from floating point strings. A floating point
string is taken to be a string of digits with up to one comma or period
mixed in with the digits.
-}class(Intablebf,Fractionalf)=>Floatablebfwherefloat::b->finstanceFloatableByteStringFloatwherefloat=strict_floatinstanceFloatableByteStringDoublewherefloat=strict_floatinstanceFloatableByteStringRationalwherefloat=strict_floatinstanceFloatableLazy.ByteStringFloatwherefloat=lazy_floatinstanceFloatableLazy.ByteStringDoublewherefloat=lazy_floatinstanceFloatableLazy.ByteStringRationalwherefloat=lazy_floatstrict_floatbytes|nullbytes=0|headbytes=='-'=foldn0(tailinteger)+nfrac|headbytes=='+'=foldp0(tailinteger)+pfrac|otherwise=foldp0integer+pfracwherefoldn=foldl'negativefoldp=foldl'positive(integer,fractional)=breakpointbytesfractional'=tailfractionalp=0.1^lengthfractional'nfrac|nullfractional=0|otherwise=foldn0fractional'*ppfrac|nullfractional=0|otherwise=foldp0fractional'*plazy_floatbytes|Lazy.nullbytes=0|Lazy.headbytes=='-'=foldn0(Lazy.tailinteger)+nfrac|Lazy.headbytes=='+'=foldp0(Lazy.tailinteger)+pfrac|otherwise=foldp0integer+pfracwherefoldn=Lazy.foldlChunks(foldl'negative)foldp=Lazy.foldlChunks(foldl'positive)(integer,fractional)=Lazy.breakpointbytesfractional'=Lazy.tailfractionalp=0.1^Lazy.lengthfractional'nfrac|Lazy.nullfractional=0|otherwise=foldn0fractional'*ppfrac|Lazy.nullfractional=0|otherwise=foldp0fractional'*ppointc=c=='.'||c==','