A FormURLEncoded
datatype represents an ordered list of key-value pairs
with possible duplicates. encode
function allows to transform FormURLEncoded
into a Maybe String
according to application/x-www-form-urlencoded
.
decode
function transforms a string into a Maybe FormURLEncoded
structure.
Documentation is available on Pursuit.
Example:
> import Data.FormURLEncoded (fromArray, encode)
> import Data.Maybe (Maybe(..))
> import Data.Tuple (Tuple(..))
> encode (fromArray [ Tuple "hey" Nothing
> , Tuple "Oh" (Just "Let's go!")
> ])
Just "hey&Oh=Let's%20go!"
> decode "a=aa&b=bb"
Just (FormURLEncoded [(Tuple "a" (Just "aa")),(Tuple "b" (Just "bb"))])
Read the contribution guidelines to get started and see helpful related resources.