haskell-servant / example-servant-elm Goto Github PK
View Code? Open in Web Editor NEWExample for a web app with a servant backend and an elm frontend
Example for a web app with a servant backend and an elm frontend
I started to get this example running. Elm is in Version 0.17, not 0.18. When I tried to update elm I recognised the Api code is generated by elm-export
and servant-elm
. I think I could help update the elm code. The haskell server part is not too straight forward to update because there seem to be more breaking changes:
server/src/Api.hs:37:10: error:
• No instance for (ElmType Integer)
arising from a use of ‘elm-export-0.6.0.1:Elm.Type.$dmtoElmType’
• In the expression: elm-export-0.6.0.1:Elm.Type.$dmtoElmType @Item
In an equation for ‘toElmType’:
toElmType = elm-export-0.6.0.1:Elm.Type.$dmtoElmType @Item
In the instance declaration for ‘ElmType Item’
make[1]: *** [Api.elm] Error 1
make: *** [client-build] Error 2
Would be awesome if this example could be updated and work again.
The update to Elm 0.19.1 is expected to be easy.
I got a type error when I try to make it run. I checked the Network.Wai.MakeAssets
you were using and it returns IO Application
as well. Not sure how your example works.
Expected type: IO (Server WithAssets)
Actual type: IO (Server Api :<|> Application)
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
module App
( startApp
) where
import Control.Concurrent
import Control.Monad.IO.Class
import Control.Monad.Trans.Except
import Network.Wai
import Network.Wai.MakeAssets
import Network.Wai.Handler.Warp
import Servant
import Api
type WithAssets = Api :<|> Raw
withAssets :: Proxy WithAssets
withAssets = Proxy
startApp :: IO ()
startApp = run 8080 =<< app
app :: IO Application
app = serve withAssets <$> server
server :: IO (Server WithAssets)
server = do
assets <- serveAssets def
return $ apiServer :<|> assets
apiServer :: Server Api
apiServer = return users
users :: [User]
users =
[ User "Isaac Newton" 372
, User "Albert Einstein" 136
]
Hello, i'm having this error when running make:
$ make
(cd client ; elm package install -y)
Packages configured successfully!
stack setup
stack will use a locally installed GHC
For more information on paths, see 'stack path' and 'stack exec env'
To use this GHC and packages outside of a project, consider using:
stack ghc, stack ghci, stack runghc, or stack exec
stack test --only-dependencies
No .cabal file found in directory /project-path/example-servant-elm/
make: *** [server-setup] Error 1
don't we need a cabal for the haskell package to use stack?
Elm 0.19 is released. We have to wait for haskell-servant/servant-elm#44 to arrive. But otherwise this repository can be updated.
All Elm dependencies but elm-html-test
were updated. It looks like elm-html-test
is listed, but not used in the codebase.
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.