úÎ>½<(      !"#$%&'(c) Dennis Gosnell, 2016BSD-style (see LICENSE file)cdep.illabout@gmail.com experimentalPOSIXNone-059:;EWrapper to add an extra field with info about the error. Used with  .)Actual error information we want to send.+Additional error information in plain text.ENewtype wrapper to be able to provide specific instances. Used with  .<Wrapper around either a success or an error. Isomorphic to (..The only interesting part of this type is the ) and * instances. ZMain type to be used. Wrapper around responses from an API, mainly used with a JSON API.Type synonym around . Smart constructor for .$toErr "DB_ERROR" "an error occurred">Err {errErr = "DB_ERROR", errExtra = Just "an error occurred"} Smart constructor for  that doesn't use an .toErr' "DB_ERROR"-Err {errErr = "DB_ERROR", errExtra = Nothing} Wrap an a in a success  .*toSuccessEnvelope 3 :: Envelope String IntEnvelopeSuccess (Success 3) Wrap an a' and an additional message in an error  .VtoErrEnvelope "DB_ERROR" "there was an error with the database" :: Envelope String Int_EnvelopeErr (Err {errErr = "DB_ERROR", errExtra = Just "there was an error with the database"})+Wrap an a in an error  .0toErrEnvelope' "DB_ERROR" :: Envelope String Int;EnvelopeErr (Err {errErr = "DB_ERROR", errExtra = Nothing}) Throw an 'Err e' using , in a - that implements .. If you have ExceptT ( e)| somewhere inside your monad transformer stacks, this function can be used to throw an error (return early) in a function.'import Control.Monad.Except (runExcept)TthrowEnvelopeErr "BAD_ERROR" "a very bad error occurred!" :: Either (Err String) IntOLeft (Err {errErr = "BAD_ERROR", errExtra = Just "a very bad error occurred!"})-Here is a longer example using a monad stack. ÿtype MyMonadStack = ReaderT Int (ExceptT (Err String) IO) doSomething :: Int -> MyMonadStack Int doSomething int = if int < 0 then throwEnvelopeErr "INT_TOO_SMALL" "the integer passed to doSomething is too small" else return (int + 1)Like ! but without providing a message.'import Control.Monad.Except (runExcept)TthrowEnvelopeErr "BAD_ERROR" "a very bad error occurred!" :: Either (Err String) IntOLeft (Err {errErr = "BAD_ERROR", errExtra = Just "a very bad error occurred!"})Parse a form produced by the / instance. Use 0s  to parse the error parameter. Just use the /% instance of the underlying datatype..The resulting Form object will look like this: # [("extra", ...), ("error", ....)] &Parse the JSON object produced by the ) instance.For  e , wrap the e in an object with "extra" and "error" fields..The resulting JSON object will look like this: ! { "extra": ..., "error": .... } Use the 1% instance of the underlying datatype.Use the /% instance of the underlying datatype.&Parse the JSON object produced by the ) instance.For  a , wrap the a in an object with a "data" field..The resulting JSON object will look like this:  { "data": ... } Looks for the key "error" in the 2+. If it is found, assume this form is an 'Err e'#. If it is not found, assume this 2 is an a.WARNING : If the a is encoded with a key "error", this 2 will be decoded as a  instead of a '. This is probably not what you want.Uses the underlying / instance for both the  case and the  case.<Tries to parse a successful response. If you are using the  " type synonym, this will use the * instance for .FIf that fails, try to parse an error response. If you are using the  ! type synonym, this will use the * instance for . +     +3      !"#$%&'()*+,-./-012345*673489:;9<=9:>9:?@'envelope-0.2.1.0-9uJEFhR9c8o8KDqOMvcnxW Web.EnvelopeWeb.HttpApiDataparseQueryParamErrerrErrerrExtraSuccess Envelope' EnvelopeErrEnvelopeSuccessEnvelopetoErrtoErr'toSuccessEnvelope toErrEnvelopethrowEnvelopeErrthrowEnvelopeErr' $fFromFormErr $fToFormErr $fFromJSONErr $fToJSONErr$fFromFormSuccess$fToFormSuccess$fFromJSONSuccess$fToJSONSuccess$fFromFormEnvelope'$fToFormEnvelope'$fFromJSONEnvelope'$fToJSONEnvelope'$fDataEnvelope' $fEqEnvelope'$fGenericEnvelope'$fShowEnvelope' $fDataSuccess $fEqSuccess$fGenericSuccess $fShowSuccess $fDataErr$fEqErr $fGenericErr $fShowErrbase Data.EitherEither$aeson-1.0.2.1-JhZNpAmlJ04FJVjHHUBYQAData.Aeson.Types.ToJSONToJSONData.Aeson.Types.FromJSONFromJSONtoErrEnvelope' mtl-2.2.1-6qsR1PHUy5lL47Hpoa4jCMControl.Monad.Error.Class throwErrorGHC.BaseMonad MonadError*http-api-data-0.3.2-7JFcZf0VL8M4fyKFX1kWvaWeb.Internal.FormUrlEncodedToFormWeb.Internal.HttpApiDataFromHttpApiDataFromFormForm