yesodweb / yesodweb.com-content Goto Github PK
View Code? Open in Web Editor NEWContent for the www.yesodweb.com site
Home Page: http://www.yesodweb.com/
License: Other
Content for the www.yesodweb.com site
Home Page: http://www.yesodweb.com/
License: Other
Haskell newbie, likely doing something dumb. I'm trying to run the blog example from Yesod book, and am getting an error:
blog.hs:183:36:
Expecting two more arguments to `SqlPersistT'
Expected kind `*', but `SqlPersistT' has kind `(* -> *) -> * -> *'
In the type `SqlPersistT'
In the type instance declaration for `YesodPersistBackend'
In the instance declaration for `YesodPersist Blog'
Googling takes me to what looks like a similar report (yesodweb/yesod#244), but I don't understand the described fix. Is this the same thing?
I don't know how apiname element is rendered into HTML, but when provided with a module, the book links to hackage are broken (. in module name not translated to - in link), eg from the forms chapter:
yesod-form:Yesod.Form.Types
results in a link to http://hackage.haskell.org/packages/archive/yesod-form/latest/doc/html/Yesod.Form.Types.html
FWIW a package or field results in a working link; latter does translate . to - eg
yesod-form:Yesod.Form.Fields:intField
I see non-broken http://hackage.haskell.org/packages/archive/yesod-form/latest/doc/html/Yesod-Form-Fields.html#v:intField
Often when I go to yesodweb.com to read blog posts the site does not render correctly on the first load. I normally have to reload the page several times in order to get everything rendering correctly. Code blocks often are the only blog elements other then the template that seem to render correctly. What renders and what does not often changes on every load though all similar elements render together or not at all.
Here are some samples.
http://imgur.com/a/l7JPN
I see this on
chrome: 33.0.1750
but not
safari: 7.0.3
This particular example seem to be removed from this repo, so submitting issue instead of PR.
Compiling this example from the book will yield some errors. Here's a fix in pseudo-diff:
- 7 import Yesod.Auth.BrowserId (authBrowserId)
- 9 import Network.HTTP.Conduit (Manager, newManager, def)
- 250 manager <- newManager def
+ 7 import Yesod.Auth.BrowserId (authBrowserId, def)
+ 9 import Network.HTTP.Client (defaultManagerSettings)
+ 10 import Network.HTTP.Conduit (Manager, newManager)
+ 251 manager <- newManager defaultManagerSettings
The existing "Deploying your Webapp" chapter has great information on deploying an app with full stack setup. Increasingly, docker is being used to deploy apps so there should probably be a chapter on it. As a nice to have there could be a section on how to deploy to some of the major cloud providers like AWS and Google Cloud. Also, since the currently deploying chapter already has a lot of information it may make sense to have it as a separate chapter under the advanced section. Thoughts?
'basics.asciidoc' advises doing a 'yesod init' for getting the scaffolding, but 'haskell.asciidoc' only gives the info for 'cabal install yesod', not 'cabal install yesod-bin'.
At http://www.yesodweb.com/book/deploying-your-webapp code blocks lack newlines.
I wrote a new blog article: https://github.com/yesodweb/yesodweb.com-content/blob/master/blog/2015/08/ssl-server-test.md
@snoyberg May I ask to correct my broken English?
@AaronFriel Would you check your part?
@snoyberg This markdown included hard-coded color information. Colors are ignored when viewing on github. What about yesod.com? Can we see red/orange/green text?
Section "Constructing Widgets" (first paragraph) currently reads as (highlighted by me):
"In order to use widgets, you’ll obviously need to be able to get your hands on them. The most common way will be via the ToWidget typeclass, and its toWidget method. This allows you to convert your Shakespearean templates directly to a Widget: Hamlet code will appear in the body, Julius scripts inside a <script> tag in the head, and Cassius and Lucius in a <style> tag."
Actually, scripts are inserted at the end of the body as shown in Synopsis section. So section text should be adjusted.
yesodweb.com-content / book / chapters / routing-and-handlers.dita line 179 is
/wiki/_Texts WikiR GET
and I believe it should be
/wiki/_Text WikiR GET
otherwise please explain, why its "Texts".
As this is a separate repository within yesodweb (yesodweb.com-content is separate from yesodweb.com here at GH), it isn't absolutely clear that the license which states that it otherwise covers documentation and source is applicable here. It would be nice to have a license file here making this clear (or clarifying what license is used for the content part, if different of course, I certainly hope there's no question that documentation is under a free/open license)
The advanced examples are difficult to follow along without package dependency information. Consider that in the wiki example its not at all clear where Text.Markdown
is supposed to come from. Indeed, hoogle isn't much help, suggesting yesod-markdown as the only reasonable possibility.
Could the examples be written as cabalized programs, perhaps in tutorial style with the yesod
executable?
The tag [source, something] is missing after "Now we want to interpolate those Msg values directly in the template. For that, we use underscore interpolation." in the file "Now we want to interpolate those Msg values directly in the template. For that, we use underscore interpolation.".
This result in a strange "one-line" output in http://www.yesodweb.com/book-1.2/shakespearean-templates.
Persistent supports more complex sum types than enums (https://github.com/yesodweb/persistent/blob/master/persistent-test/SumTypeTest.hs) but there is no documentation on this feature.
The wording in "Lower case" refers to the format generated table names are created.
[1] is kinda off. Not sure how to correct it.
It seems, that all changes, made between commit 2e3aad6 (on 29 Apr 2012) and book version splitting, have been lost. Changes from commit 2e3aad6 are in both versions, but changes from the next commit 2da5ce3 (on 14 May 2012) are not.
Possibly part of the changes is obsolete, but others may be still relevant (e.g, b86fcb8, 4b1e246 and 85d6823).
The sample code given won't compile because of a type error. In code of 'RepHtmlJson', function 'getNameR' line 176, it won't compile with:
let json = object ["name" .= name]
so it should be more like:
let json = return $ object ["name" .= name]
GHC gives the following error:
Home.hs:51:30:
Couldn't match expected type 'HandlerT site0 IO a1'
with actual type 'Value'
In the second argument of 'defaultLayoutJson', namely 'json'
In a stmt of a 'do' block: defaultLayoutJson widget json
In the expression:
do { let widget = ...;
let json = object ...;
defaultLayoutJson widget json }
There's no reference in the chapter about recommended comment syntax for the shakespeare languages
The deployment chapter perhaps could be updated to show how a deployment workflow with Stack could work. Even nicer would be a Stack + Docker workflow
It would be easier to refer to specific parts of the book, if the headlines had anchor links to them.
I think a great example is the way Django documentation does it. When you hover over a headline, a line end symbol (or whatever it's called) appears and contains a link to the headline so that you can copy the link from there.
This is just a suggestion for enhancement. It's useful to refer people to specific sections in discussions when giving a link to whole chapter is too unspecific.
I was about to make a pull request for a minor improvement in one of the book chapters, but I'm a bit confused if I'm supposed to edit the raw dita
files or if this is the right place to make changes to the book.
A readme file would be great to have in the root of the repository, explaining if here is the right place to make edits for the book or not.
https://github.com/yesodweb/yesodweb.com-content/blob/master/book/basics.asciidoc shows nice highlighting compared with http://www.yesodweb.com/book/basics
UPDATE: Actually, it's really weird. I'm using Firefox for reference. When I go to a URL directly, syntax highlighting works, but if I click a link in the navigation of the book on the side, then I see no syntax highlighting until I click to reload the page — then it shows up!
Hi Michael,
I was wondering how often O'Reilly updates the ebook versus the current online version of the Yesod book (I noticed in my O'Reilly account the last update date is in March). Is it just from one major version (e.g., 1.4 to 1.5) or something like that, or can they update it real time even with minor updates to the framework and the online version of the book?
Is there anything like a private repo for subscribers to get regenerated PDF's?
Thanks :)
Hi. I've spotted some error in the Persistent chapter. Probably the book just hasn't been up-to-date with the code.
persist
quasi-quoter should be actually persistUpperCase
or persistLowerCase
EmptyDecls
extension should be turned onThanks.
E.g. here: http://www.yesodweb.com/book/basics
There's an extra chapters
path component.
Following this example
It seems we should use the Yesod.Auth.GoogleEmail2 as the URLs used by GoogleEmail
are deprecated.
I am unable to find them.
If not, what's the alternatives? And the widgets chapter needs to be updated.
addCassiusMedia, addLuciusMedia
Works the same as toWidget, but takes an additional parameter to indicate what kind of media this applies to. Useful for creating print stylesheets, for instance.
Hello,
your website appear to be down since 2013-07-23 03:00:00 (Error code: ERR_CONNECTION_RESET)
Sincerly,
Thibault.
Hello,
A moment ago, I needed a default time value in a new column of a table in one
of my Yesod pages. This was my table without the default:
Entry
title Text
posted UTCTime
updated UTCTime
content Markdown
"updated" is the new table. [1] uses "updated UTCTime default=CURRENT_TIME" somewhere, but indeed, PostgreSQL did not want to accept this:
Migrating: ALTER TABLE "entry" ADD COLUMN "updated" TIMESTAMP NOT NULL DEFAULT CURRENT_TIME
devel.hs: SqlError {sqlState = "42804", sqlExecStatus = FatalError, sqlErrorMsg = "Spalte \"updated\" hat Typ timestamp without time zone, aber der Vorgabeausdruck hat Typ time with time zone", sqlErrorDetail = "", sqlErrorHint = "Sie müssen den Ausdruck umschreiben oder eine Typumwandlung vornehmen."}
Well, this is german, so I'll translate the message: "Column "updated" has type timestamp without time zone, but the default expression has the type time with time zone"
Typewise, the expression "CURRENT_TIMESTAMP" would fit (according to the postgreSQL documentation, it has the type TIMESTAMP WITH TIME ZONE).
However, on saving this into a column without a time zone (as persistent generated from the definition above), PostgreSQL drops the time zone. In the end, it writes local time values into the database. I decided to use now
and set the time zone explicitly:
updated UTCTime "default=now() at time zone 'utc'"
Perhaps it would be a good idea to use something like that in the Yesod Book
Best regards
Bastian
Hi there, I've just recently begun reading the yesod book and stumbled upon this sentence in the last paragraph of the 'Basics' chapter:
"For rapid development, you can use yesod devel is a good choice."
As far as I can tell this ought to be either:
"For rapid development, you can use yesod devel." OR
"For rapid development, yesod devel is a good choice."
Was that something O'Reilly insisted upon? I was thinking of eventually contributing some improvements to the book, but now I'm not even allowed to use the material freely, and that's discouraging. NC is already non-free, but ND is additional restriction. That's an unfortunate mark, although I suppose it's true that there's at least the Haddock for the exact Yesod code, but the Yesod Book is otherwise the plain core documentation…
I'm not sure making this ticket is appropriate, but just wanted to clarify and understand the situation. I find it quite unfortunate. I suspect that the NC-ND terms do not actually lead to even the tiniest increase in sales or otherwise achieve anything positive whatsoever…
Thanks otherwise for all the great work on the software and licensing the rest of the site freely.
Hi
What's wrong with this addHead middleware? Custom header is not added.
It's similar to http://hackage.haskell.org/package/wai-extra-3.0.1/docs/src/Network-Wai-Middleware-AcceptOverride.html
Libraries: warp-3.0.0.4, wai-3.0.0.2
{-# LANGUAGE OverloadedStrings #-}
import Network.Wai.Handler.Warp
import Network.HTTP.Types.Status
import Network.Wai
import Data.ByteString.Lazy
main = run 8080 $ addHead $ body
body req respond = respond $ responseLBS (Status 200 "OK") [] "My server"
addHead app req = app $ req { requestHeaders = myHead : requestHeaders req }
myHead = ("X-Foo", "My very custom header")
In authentication chapter I stumbled upon subj (in the first note of the chapter). I do not remember anything about this topic in mailing list and can not find anything in haddocks.
Maybe this note should be updated?
File book/yesod-web-framework-book.xml contains <xi:include href="ch00.xml"/>, but there is no such file. It seems to be an invalid docbook.
One snag with using a separate domain for static content is that if you want to serve the site over https you'll need a separate SSL certificate (or a wildcard, or one that gives static... as a Subject Alternative Name). It might be worth mentioning this.
I'm not sure if I can fix it directly on github or if the book's pages are still generated from some other source, so I'm reporting it here first. Some problems found by shapr
on the yesod IRC channel:
share .. [persistLowercase|
lineen.msg
and shakespeare doesn't give a helpful message either.en.msg
file contents should be highlighted or typeset differently somehow, line breaks are messed upgenerateFormPost
result type was changedfieldLabel
needs SomeMessage
nowen.msg
)the web site goes berserk when Cmd-+ or Cmd-- is pressed for about 3-4 seconds, and then normalizes. It makes zooming in and out very inconvenient! I guess there's a JS component on the web site trying to make zoom animated, which is causing this?
Either I missed the secret message you're trying to communicate or this should probably be deleted.
The external file example in https://github.com/yesodweb/yesodweb.com-content/blob/master/book/shakespearean-templates.asciidoc#calling-shakespeare produces empty output.
(I am enjoying working through the book so far. great work!).
The output is an empty line, and if I intentionally break the lucius template, I don get any errors. Removing the CPP if/else/endif does not help, I get empty output from luciusFile and luciusFileDebug, and no error reported.
If I remove template.lucius, I do get an error. I'm on yesod-1.2.7.3
To eliminate typos, I copy pasted the example from yesod.com.
example with CPP out of the way:
{-# LANGUAGE OverloadedStrings #-} -- we're using Text below
{-# LANGUAGE TemplateHaskell #-}
--{-# LANGUAGE CPP #-} -- to control production versus debug
import Text.Lucius (CssUrl, luciusFile, luciusFileDebug, renderCss)
import Data.Text (Text)
import qualified Data.Text.Lazy.IO as TLIO
data MyRoute = Home | Time | Stylesheet
render :: MyRoute -> [(Text, Text)] -> Text
render Home _ = "/home"
render Time _ = "/time"
render Stylesheet _ = "/style.css"
template :: CssUrl MyRoute
template = $(luciusFileDebug "template.lucius")
--template = $(luciusFileDebug "template.lucius")
main :: IO ()
main = TLIO.putStrLn $ renderCss $ template render
intentionally broken lucius file (missing } ):
{- @template.lucius
foo { bar: baz
-}
ghc output:
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package array-0.4.0.1 ... linking ... done.
Loading package deepseq-1.3.0.1 ... linking ... done.
Loading package filepath-1.3.0.1 ... linking ... done.
Loading package old-locale-1.0.0.5 ... linking ... done.
Loading package time-1.4.0.1 ... linking ... done.
Loading package bytestring-0.10.0.2 ... linking ... done.
Loading package unix-2.6.0.1 ... linking ... done.
Loading package directory-1.2.0.1 ... linking ... done.
Loading package process-1.1.0.2 ... linking ... done.
Loading package containers-0.5.0.0 ... linking ... done.
Loading package text-0.11.3.1 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package mtl-2.1.2 ... linking ... done.
Loading package parsec-3.1.3 ... linking ... done.
Loading package system-filepath-0.4.9 ... linking ... done.
Loading package system-fileio-0.3.12 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package shakespeare-1.2.1.1 ... linking ... done.
Loading package shakespeare-css-1.0.7.1 ... linking ... done.
Linking shakespeare04-external-stylesheet ...
Michael, do you plan to fix it?
Do I undestand it right that the problem is Approot type which isn't mentioned in that chapter?
I'm translating this chapter right now and that FIXME bothers me a little bit
This page on yesodweb.com is broken. Not sure if it's related to the actual content or not, though.
The error message is:
Internal Server Error
UnresolvedEntityException (fromList ["rsquo"])
Hi,
Firstly, thanks for all your time and work, this has been great to go through (I even bought a hardcopy, outdated as it is).
At the top of every chapter, the "View source on Github" link directs you to an .xml file which 404s. The files are all .asciidoc
In the first example ("Authenticate Me") of the "Authentication and Authorization" chapter, you import "def" from "Network.HTTP.Conduit". It seems as of http-conduit 2.0.0, you stopped exporting "def".
Edit: I first tried using def from Data.Default, but there was no instance; I assume this is intentional. I was able to get it to work by importing "defaultManagerSettings" directly from "Network.HTTP.Client.Internal" of "http-client", but your warning there made it seem like you don't want people directly accessing it.
Thanks again!
The dispatch function refers to all of the handler functions, and therefore all of those must either be defined in the same file as the dispatch function, or be imported by the dispatch function.
From http://www.yesodweb.com/book/scaffolding-and-the-site-template#171-x-8
Maybe there should be before instead of by in that sentence? Otherwise it is not clear how Haskell function could import other functions...
I'm not sure how to post a link to a phrase on a website but in the source code it's located at https://github.com/yesodweb/yesodweb.com-content/blob/master/book/chapters/case-study-sphinx.dita#L1084 :
Let's first look at query:
And after that there is no code for query
and just use of S.query (and before that you say that hasn't been defined yet
and I understand it as it will be defined a bit later) inside quite long piece of code.
And there's a lot of copy-paste in this chapter. For Russian translation we are trying to cut code into the pieces which are described in the text nearby.
As I look into DITA sources it looks like DITA -> HTML conversion is broken (if -- START
and -- STOP
are part of DITA spec)
yesod-1.2.6.1
Chat/Data.hs, function getReceiveR
:
Couldn't match expected type `IO
wai-3.0.2:Network.Wai.Internal.Response'
with actual type `(wai-3.0.2:Network.Wai.Internal.Response
-> IO wai-3.0.2:Network.Wai.Internal.ResponseReceived)
-> IO wai-3.0.2:Network.Wai.Internal.ResponseReceived'
In the return type of a call of `eventSourceAppChan'
Probable cause: `eventSourceAppChan' is applied to too few arguments
In the second argument of `($)', namely
`eventSourceAppChan chan req'
In a stmt of a 'do' block:
res <- liftIO $ eventSourceAppChan chan req
The last bullet at the end of the Shakespeare chapter is split into three separate bullets.
When following the Blog example, I ran into the issue where comments from all entries were being loaded into a single Entry. Which is what the book is suggesting:
getEntryR :: EntryId -> Handler Html
getEntryR entryId = do
(entry, comments) <- runDB $ do
entry <- get404 entryId
comments <- selectList [] [Asc CommentPosted]
return (entry, map entityVal comments)
The following line:
comments <- selectList [] [Asc CommentPosted]
Shouldn't it be?
comments <- selectList [CommentEntry ==. entryId] [Asc CommentCreated]
So it only fetches the Comments for that Entry.
You have error here: http://www.yesodweb.com/blog/2012/01/blog-example
*WHICH FUNCTION
getEntryR :: EntryId -> Handler RepHtml
This example doesnt work.
comments <- selectList [CommentEntry ==. entryId] [Asc CommentPosted]
return (entry, map entityVal comments)
This works
No idea why, but manually POSTing to www.yesodweb.com/reload works.
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.