yesod

yesod init command does not work on Windows

我怕爱的太早我们不能终老 提交于 2019-12-11 05:06:47
问题 I did the following steps to install the Yesod web framework. mkdir mypackage cd mypackage cabal update cabal sandbox init cabal install yesod-platform yesod-bin --max-backjumps=-1 --reorder-goals When I then tried to do yesod init , I got an error message. 'yesod' is not recognized as an internal or external command, operable program or batch file. I used search to find any yesod-like file but I couldn't find any yesod.exe or anything like that. I have searched the entire C: drive. What

Yesod catchall route

て烟熏妆下的殇ゞ 提交于 2019-12-11 04:04:55
问题 I'm building a yesod app which consists of two parts. The rest api (yesod) and the client side (angularjs). Besides being a rest api, yesod also send the initial html to the client to start up angularjs. I have it working like this: config/routes: /user GET /someOtherEntity GET POST / HomeR GET --route to send the html Handler/Home.hs getHomeR :: Handler Html getHomeR = sendFile typeHtml "frontend/build/index.html" As long as the first url is www.mydomain.com/ this works fine, but when I go

Problems installing Yesod for Haskell

こ雲淡風輕ζ 提交于 2019-12-11 02:49:21
问题 I'm trying to install Haskell and Yesod for Mac following this guide. Everything goes fine until the last step, when I receive this error message. I've tried to manually install the hfsevebts-0.1.4 but it gives me the same error. gcc-4.8: error: language objective-c not recognized gcc-4.8: error: language objective-c not recognized cabal: Error: some packages failed to install: fsnotify-0.0.11 depends on hfsevents-0.1.4 which failed to install. hfsevents-0.1.4 failed during the building phase

Code reuse in Haxl - avoiding GADT constructor-per-request-type

血红的双手。 提交于 2019-12-11 02:35:59
问题 Haxl is an amazing library, but one of the major pain points I find is caused by the fact that each sort of request to the data source requires its own constructor in the Request GADT. For example, taking the example from the tutorial: data BlogRequest a where FetchPosts :: BlogRequest [PostId] FetchPostContent :: PostId -> BlogRequest PostContent Then each of these constructors are pattern matched on and processed separately in the match function of the DataSource instance. This style

how can I change the settings (e.g., port) used by “yesod devel”?

♀尐吖头ヾ 提交于 2019-12-10 22:57:59
问题 I know I can put port numbers in config/settings.yml but they seem to be ignored when running yesod devel . 回答1: You want to use the -p option. More generally: $ yesod devel --help Usage: yesod devel [-d|--disable-api] [-s|--success-hook COMMAND] [-f|--failure-hook COMMAND] [-t|--event-timeout N] [-b|--builddir ARG] [-i|--ignore DIR] [-e|--extra-cabal-arg ARG] [-p|--port N] [-x|--proxy-timeout N] [-n|--disable-reverse-proxy] [-c|--interrupt-only] Run project with the devel server Available

Storing Markdown in a Yesod Persist Model

删除回忆录丶 提交于 2019-12-10 19:04:17
问题 I am trying to store markdown in a field on a Persistent model with a MySQL backend. I've broken the use case down to: models: TestModel content Markdown Model.hs: import Text.Markdown (Markdown) import Yesod.Text.Markdown () .... This seems to create the correct migrations: mysql> show columns in test_model; +---------+------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------+------------+------+-----+---------+----------------+ | id |

Could not find module `Yesod'

梦想的初衷 提交于 2019-12-10 18:54:48
问题 I have the following code: {-# LANGUAGE TypeFamilies, QuasiQuotes, MultiParamTypeClasses, TemplateHaskell, OverloadedStrings #-} module Simple where import Yesod data HelloWorld = HelloWorld mkYesod "HelloWorld" [parseRoutes| / HomeR GET |] instance Yesod HelloWorld getHomeR = defaultLayout [whamlet|Hello World!|] withHelloWorld f = toWaiApp HelloWorld >>= f main = warpDebug 3000 HelloWorld If run it in GHCI, it runs normally: Ok, modules loaded: Simple. *Simple> main Application launched,

Sitewide variables in Yesod layout (django context processors analog)

强颜欢笑 提交于 2019-12-10 17:29:44
问题 Is there a possibility to have a sitewide variables in Yesod? Suppose, I have main menu which entries are gathered from DB and that is rendered on every page: should i fetch entries manually in each handler? I've tried to do this in Foundation.hs in instance Yesod App declaration in defaultLayout : instance Yesod App where ... defaultLayout widget = do ... entries <- runDB $ selectList [RubricOnTop ==. True] [] ... But this fails to compile: i have a type mismatch Entity with RubricGeneric .

yesod — password protecting staging site

寵の児 提交于 2019-12-10 17:24:25
问题 I'm trying to set up a staging instance of my yesod webserver, and I was wondering if there were some easy way to make the entire site password protected. Specifically, I want to be able to prompt those who navigate to my site for credentials. After they authenticate it should function as the typical site. But if they cannot authenticate themselves they should see nothing. 回答1: To expand on @MichaelSnoyman's answer, here's how I implemented the WAI HTTP Auth middleware: From the scaffolded

Haskell Yesod problems

坚强是说给别人听的谎言 提交于 2019-12-10 17:14:50
问题 someone could help me?! I'm working in a Haskell Yesod site for college on a C9 workspace, I've already installed by command Yesod and update cabal, but when I try "stack build" command, this miserable error message appears: $ stack build aulahaskell-0.0.0: build (lib + exe) Preprocessing library aulahaskell-0.0.0... [ 7 of 13] Compiling Handler.Cliente ( src/Handler/Cliente.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Handler/Cliente.o ) /home/ubuntu/workspace/web2017/src/Handler