haskell-servant / example-servant-minimal Goto Github PK
View Code? Open in Web Editor NEWA minimal example for a REST-API-server written with servant and a test-suite using servant-client
A minimal example for a REST-API-server written with servant and a test-suite using servant-client
During the installation
stack test --fast
No .cabal file found in directory /home/roman/sandbox/example-servant-minimal/
Did you mean to add the cabal file to the .gitignore? Without it, a naive and inexperienced newcomer (e.g., me) runs into trouble at the second step in the README. Typing "stack test --fast" results in an error message complaining about a missing cabal file.
test/AppSpec.hs:18:1: error:
• Couldn't match expected type ‘Manager
-> BaseUrl -> ClientM [Item]’
with actual type ‘ClientM [Item]’
• When checking that the inferred type
getItems :: ClientM [Item]
is as general as its signature
getItems :: Manager -> BaseUrl -> ClientM [Item]
test/AppSpec.hs:45:15: error:
• Couldn't match expected type ‘ExceptT e0 IO a’
with actual type ‘ClientM a’
• In the first argument of ‘runExceptT’, namely
‘(action manager baseUrl)’
In the second argument of ‘(=<<)’, namely
‘runExceptT (action manager baseUrl)’
In the expression:
either throwIO return =<< runExceptT (action manager baseUrl)
• Relevant bindings include
action :: Manager -> BaseUrl -> ClientM a
(bound at test/AppSpec.hs:44:24)
try :: Host -> (Manager -> BaseUrl -> ClientM a) -> IO a
(bound at test/AppSpec.hs:44:1)
Process failed: cabal build -j --ghc-options=-Werror (exit code: 1)
I updated tho the latest LTS: 12.24; I then ran into this issue:
/src/App.hs:50:8: error:
* Couldn't match expected type `Handler Item'
with actual type `ExceptT ServantErr m0 a0'
* In the expression: throwE err404
In a case alternative: _ -> throwE err404
In the expression:
\case
0 -> return exampleItem
_ -> throwE err404
|
50 | _ -> throwE err404
| ^^^^^^^^^^^^^
hello, it seems like test suite returns an error because servantError is not available anymore, could you please check it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.