Search results
The Encode
class is used to generate encoding functions
of the form a -> Foreign
using generics-rep
deriving.
First, derive Generic
for your data:
import Data.Generic.Rep
data MyType = MyType ...
derive instance genericMyType :: Generic MyType _
You can then use the genericEncode
and genericEncodeJSON
functions
to encode your data as JSON.
encode :: forall a. Encode a => a -> Foreign
encode :: FormURLEncoded -> Maybe String
Encode FormURLEncoded
as application/x-www-form-urlencoded
.
encode :: String -> Uint8Array
Encodes a String
to a Uint8Array
using UTF-8 encoding.
encode :: Uint8Array -> String
Encode a Uint8Array
to its (RFC 4648) Base64 representation.
Example:
encode $ encodeUtf8 "柿くへば鐘が鳴るなり法隆寺"
-- "5p+/44GP44G444Gw6ZCY44GM6bO044KL44Gq44KK5rOV6ZqG5a+6"
encode :: String -> String
Encode a String
to its (RFC 4648) Base64 representation.
Example:
encode "柿くへば鐘が鳴るなり法隆寺"
-- "5p+/44GP44G444Gw6ZCY44GM6bO044KL44Gq44KK5rOV6ZqG5a+6"
encode :: forall m a b c d. Codec m a b c d -> c -> b
encode :: Encoding -> String -> Uint8Array
Encodes a String
to a Uint8Array
with the given Encoding
.
encode :: forall a b c d. Codec (Except DecodeError) a b c d -> c -> b
Encodes a value as JSON using the specified code.
The Encode
class is used to generate encoding functions
of the form a -> Foreign
using generics-rep
deriving.
First, derive Generic
for your data:
import Data.Generic.Rep
data MyType = MyType ...
derive instance genericMyType :: Generic MyType _
You can then use the genericEncode
and genericEncodeJSON
functions
to encode your data as JSON.
encode :: forall a. Encode a => a -> Foreign
encode :: String -> TextEncoder -> Uint8Array
encode :: (Array Int) -> Base58
FFI wrapper to decode an Array Byte to a Maybe Base58
encode :: forall a. CookieEncoder a => a -> String
encode :: forall a. WriteCBOR a => a -> Effect Buffer
encode :: forall m a. MonadAff m => MonadThrow Error m => MonadRec m => WriteCBOR a => AsyncPipe (Maybe a) (Maybe Buffer) m Unit
Encode purescript values as CBOR buffers
encode :: Json -> ArrayBuffer
encode :: Json -> Buffer
encode :: forall a. EncodeJson a => a -> Uint8Array
encode :: String -> String
encode :: forall e a. JsonDual Identity e a -> a -> Json
encode :: String -> Either Error String
encode :: forall payload. WriteForeign payload => Secret -> Algorithm -> payload -> Effect Jwt
Encode to JWT.
encode :: forall a o op s. Symbiote a o op s => a -> s
encode' :: forall a. EncodeJson a => a -> String
encode' :: EncodeOptions -> String -> String
encodeOp :: forall a o op s. Symbiote a o op s => op -> s
encodeInt :: Int -> Json
encodeMap :: forall a b. Ord a => (a -> Json) -> (b -> Json) -> Map a b -> Json
encodeSet :: forall a. Ord a => (a -> Json) -> Set a -> Json
encodeURI :: String -> Maybe String
encodeRep :: forall r. EncodeRep r => r -> Json
encodeUrl :: Uint8Array -> String
Encode a Uint8Array
to a URL-safe Base64 representation.
Example:
encodeUrl $ encodeUtf8 "柿くへば鐘が鳴るなり法隆寺"
-- "5p-_44GP44G444Gw6ZCY44GM6bO044KL44Gq44KK5rOV6ZqG5a-6"
encodeUrl :: String -> String
Encode a String
to a URL-safe Base64 representation.
Example:
encodeUrl "柿くへば鐘が鳴るなり法隆寺"
-- "5p-_44GP44G444Gw6ZCY44GM6bO044KL44Gq44KK5rOV6ZqG5a-6"
encodeKey :: forall a. EncodeKey a => a -> String
encodeOut :: forall a o op s. Symbiote a o op s => Proxy a -> o -> s
encodeUri :: String -> String
encodeUrl :: forall urlStr params. EncodeUrl urlStr params => Proxy urlStr -> Record params -> String
encodeUrl :: forall url params. EncodeUrl url params => Options -> Proxy url -> Record params -> String