Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not be used in the client part #15

Open
picca opened this issue Apr 10, 2019 · 7 comments
Open

Can not be used in the client part #15

picca opened this issue Apr 10, 2019 · 7 comments

Comments

@picca
Copy link

picca commented Apr 10, 2019

Hello

while working on an API, I end up with this error

/home/experiences/instrumentation/picca/autoprocess-exe/src/Web.hs:95:32: error:
    • No instance for (Servant.API.ContentTypes.MimeUnrender
                         HTML (Text.Blaze.Internal.MarkupM ()))
        arising from a use of ‘client’
    • In the expression: client myApi
      In a pattern binding: postJobSpecSub :<|> homepage = client myApi
   |
95 | postJobSpecSub :<|> homepage = client myApi
   |                                ^^^^^^^^^^^^

--  While building custom Setup.hs for package autoprocessing-0.1.0.0 using:
      /home/experiences/instrumentation/picca/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.0.1.0 build lib:autoprocessing exe:autoprocessing-exe --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1

So my question is what is the proper way to use the client part in an API

Cheers

@phadej
Copy link
Contributor

phadej commented Apr 10, 2019 via email

@picca
Copy link
Author

picca commented Apr 10, 2019 via email

@phadej
Copy link
Contributor

phadej commented Apr 10, 2019

type RestApi = ...
type HtmlApi = ...

type Api = RestApi :<|> HtmlApi

h1 = client restApi

@picca
Copy link
Author

picca commented Apr 10, 2019 via email

@phadej
Copy link
Contributor

phadej commented Apr 10, 2019

restApi = Proxy :: Proxy RestApi

@picca
Copy link
Author

picca commented Apr 10, 2019 via email

@coderfromhere
Copy link

coderfromhere commented May 27, 2021

can't MimeUnrender return a ByteString in this case? Or is it required to be bijectional to MimeRender? The class itself doesn't have this constraint it seems https://hackage.haskell.org/package/servant-0.18.2/docs/Servant-API.html#t:MimeUnrender

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants