Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- class FlattenAs (y :: Symbol) (x :: Symbol) where
- class (KnownSymbol nm, KnownSymbol ann) => FromEncString f nm ann a str where
- class (KnownSymbol nm, KnownSymbol ann) => ToEncString f nm ann a str where
- module Data.TypedEncoding.Common.Class.Common
- module Data.TypedEncoding.Common.Class.Encode
- module Data.TypedEncoding.Common.Class.Decode
- module Data.TypedEncoding.Common.Class.Validate
- module Data.TypedEncoding.Common.Class.Superset
Documentation
class FlattenAs (y :: Symbol) (x :: Symbol) where Source #
Flatten is more permissive IsSuperset
instance FlattenAs "r-ASCII" "enc-B64" where -- OK
Now encoded data has form Enc '["r-ASCII"] c str
and there is no danger of it begin incorrectly decoded.
Since: 0.1.0.0
Nothing
Instances
FlattenAs "r-ASCII" "enc-B64" Source # | Since: 0.1.0.0 |
FlattenAs "r-ASCII" "enc-B64-nontext" Source # | allow to treat B64 encodings as ASCII forgetting about B64 encoding
Since: 0.1.0.0 |
class (KnownSymbol nm, KnownSymbol ann) => FromEncString f nm ann a str where Source #
Reverse of ToEncString
decodes encoded string back to a
Since: 0.2.0.0
Instances
(IsStringR str, UnexpectedDecodeErr f, Applicative f) => FromEncString (f :: Type -> Type) "r-Word8-decimal" "r-Word8-decimal" Word8 str Source # | |
(UnexpectedDecodeErr f, Applicative f) => FromEncString (f :: Type -> Type) "r-IPv4" "r-IPv4" IpV4 Text Source # |
To get
The conversion of a list to IpV4F needs handle errors but these errors are considered unexpected. Note, again, the error condition exposed by this implementation could have been avoided
if |
class (KnownSymbol nm, KnownSymbol ann) => ToEncString f nm ann a str where Source #
Generalized Java toString
or a type safe version of Haskell's Show
.
Encodes a
as Enc '[xs]
specifying algorithm alg
and using effect f
Since: 0.2.0.0
Instances
(IsString str, Applicative f) => ToEncString f "r-Int-decimal" "r-Int-decimal" Int str Source # | |
(IsString str, Applicative f) => ToEncString f "r-Word8-decimal" "r-Word8-decimal" Word8 str Source # | |
ToEncString Identity "r-IPv4" "r-IPv4" IpV4 Text Source # | In this example This is done with help of existing
Implementation is a classic map reduce where reduce is done with help of
Note lack of type safety here, the same code would work just fine if we added
5th field to Using something like a dependently typed Vect 4 (Enc '["r-Word8-decimal"] () T.Text) would have improved this situation.
Currently, 'type-encoding' library does not have these types in scope. |