Go to file
patrick brisbin dc2d5d9cd0
Stop moving session language ahead of reqLangs
Yesod.Core.Handler.languages checks first for a language set in the
user's session, prepending that value to YesodRequest{reqLangs}, so it
is respected above all else if present.

For context, reqLangs itself also includes the session, but just later
in line:

    langs' = catMaybes [ lookup langKey gets -- Query _LANG
                       , lookup langKey cookies     -- Cookie _LANG
                       , lookupText langKey session -- Session _LANG
                       ] ++ langs                    -- Accept-Language(s)

In #1720, it was raised that allowing the session (something implicitly
present for any request) to override a query parameter (something
explicitly given on that request) is surprising.

We decided (without knowing what order reqLangs was doing) that query,
cookie, session, accept was best and languages should be changed to do
that. Conveniently, this just makes languages equivalent to reqLangs, so
that is what this patch does.
2021-04-08 09:34:38 -04:00
.github Support persistent 2.12 2021-03-30 21:48:10 +03:00
demo Remove unnecesary Typeable deriving 2020-01-17 11:48:58 -05:00
yesod bump yesod version 2020-08-09 13:45:16 +01:00
yesod-auth Support persistent 2.12 2021-03-30 21:48:10 +03:00
yesod-auth-oauth cabal-version bump for Hackage 2020-11-08 12:49:42 +02:00
yesod-bin Simplified implementation of cert/key parser option 2021-02-10 13:54:22 +00:00
yesod-core Stop moving session language ahead of reqLangs 2021-04-08 09:34:38 -04:00
yesod-eventsource New cabal-version for Hackage 2020-11-08 12:52:23 +02:00
yesod-form Drop dependency on semigroups 2020-08-02 17:30:19 +08:00
yesod-form-multi Fixed bug when duplicating option tags (#1716) 2021-01-08 19:03:46 +00:00
yesod-newsfeed Drop LTS 9 2020-01-07 13:36:58 +02:00
yesod-persistent Fix changelog 2021-03-30 22:13:53 +03:00
yesod-sitemap Drop LTS 9 2020-01-07 13:36:58 +02:00
yesod-static One more sort for #1684 2020-07-04 19:09:50 +03:00
yesod-test Version bump 2020-12-16 05:45:46 +02:00
yesod-websockets Change cabal-version syntax 2021-04-03 22:37:00 +03:00
.gitignore Ignore stack.yaml.lock 2019-07-06 14:22:32 +12:00
CODE_OF_CONDUCT.md Switch CoC to Contributor Covenant 2017-12-06 16:02:01 +02:00
CONTRIBUTING.md Respond to @psibi's comments 2017-11-08 22:43:51 -08:00
Dockerfile add a Dockerfile for haskell development 2015-05-27 11:43:16 -04:00
LICENSE Switch to copyright year range #617 2017-02-27 09:47:45 +02:00
README.md Move to actions, test persistent 2.11 2020-11-06 07:15:17 +02:00
stack-persistent-211.yaml Move to actions, test persistent 2.11 2020-11-06 07:15:17 +02:00
stack-persistent-212.yaml Support persistent 2.12 2021-03-30 21:48:10 +03:00
stack.yaml Azure matrix/stack.yaml update 2020-03-24 12:20:19 +02:00
stack.yaml.lock Azure matrix/stack.yaml update 2020-03-24 12:20:19 +02:00

Tests

Yesod Web Framework

An advanced web framework using the Haskell programming language. Featuring:

  • safety & security guaranteed at compile time
  • developer productivity: tools for all your basic web development needs
  • raw performance
    • fast, compiled code
    • techniques for constant-space memory consumption
  • asynchronous IO
    • this is built in to the Haskell programming language (like Erlang)

Getting Started

Learn more about Yesod on its main website. If you want to get started using Yesod, we strongly recommend the quick start guide, based on the Haskell build tool stack.

Here's a minimal example!

{-# LANGUAGE OverloadedStrings, QuasiQuotes, TemplateHaskell, TypeFamilies #-}

import Yesod

data App = App -- Put your config, database connection pool, etc. in here.

-- Derive routes and instances for App.
mkYesod "App" [parseRoutes|
/ HomeR GET
|]

instance Yesod App -- Methods in here can be overridden as needed.

-- The handler for the GET request at /, corresponds to HomeR.
getHomeR :: Handler Html
getHomeR = defaultLayout [whamlet|Hello World!|]

main :: IO ()
main = warp 3000 App

To read about each of the concepts in use above (routing, handlers, linking, JSON), in detail, visit Basics in the Yesod book.

Hacking on Yesod

Yesod consists mostly of four repositories:

git clone --recurse-submodules http://github.com/yesodweb/shakespeare
git clone --recurse-submodules http://github.com/yesodweb/persistent
git clone --recurse-submodules http://github.com/yesodweb/wai
git clone --recurse-submodules http://github.com/yesodweb/yesod

Each repository can be built with stack build.