Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
ToStrInj
and ToStrIso
are future replacement for Data.TypedEncoding.Common.Class.IsStringR (currently not used).
Synopsis
- class ToStrInj str from where
- toString :: from -> str
- prop_toStringFromString :: forall s. (IsString s, ToStrInj String s) => Proxy s -> String -> Bool
- class ToStrInj str from => ToStrIso str from
- prop_fromStringToString :: forall s. (IsString s, ToStrIso String s, Eq s) => s -> Bool
- class Char8Find str where
Documentation
>>>
:set -XScopedTypeVariables -XTypeApplications -XAllowAmbiguousTypes
>>>
import Test.QuickCheck
>>>
import Test.QuickCheck.Instances.Text()
>>>
import Test.QuickCheck.Instances.ByteString()
IsString reversal
class ToStrInj str from where Source #
Reverses IsString
law for types that are also IsString
:
toString . fromString == id
Note: ByteString is not a valid instance, ByteString "r-ASCII", or "r-UTF8" would
be needed.
B8.unpack $ B8.pack "160688" == "176"
This class is separated from ToStrIso
to allow instances from smaller types
the can inject into the String
type.
Since: 0.3.0.0
prop_toStringFromString :: forall s. (IsString s, ToStrInj String s) => Proxy s -> String -> Bool Source #
class ToStrInj str from => ToStrIso str from Source #
Same as ToStrInj
but with additional
law for types that are also IsString
:
fromString . toString == id
Since: 0.3.0.0
class Char8Find str where Source #
Used to find exceptions that violated "r-" encoding Expected to be used to check encoding of ASCII-7 so Text and ByteString are compatible.
Since: 0.3.0.0
Instances
Char8Find String Source # | |
Char8Find ByteString Source # | |
Char8Find ByteString Source # | B8.pack is basically a convenient way to get Word8 elements into ByteString. During B8.pack conversion charters are downsized to the 0-255 range (become a Word8). The length is preserved.
This instance allows to check elements of ByteString interpreting them as Char. Safe if restricting to 7bit code points. |
Char8Find Text Source # | |
Char8Find Text Source # | |