File: PolyShow.hs

package info (click to toggle)
haskell-yesod-core 1.6.26.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 672 kB
  • sloc: haskell: 7,833; makefile: 5
file content (28 lines) | stat: -rw-r--r-- 597 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{-# LANGUAGE
    TypeFamilies, QuasiQuotes, TemplateHaskell, MultiParamTypeClasses
  , OverloadedStrings, StandaloneDeriving, FlexibleInstances
  #-}
module YesodCoreTest.ParameterizedSite.PolyShow
    ( PolyShow (..)
    ) where

import Yesod.Core

-- | Parameterized with 'Show' constraint
data PolyShow a = PolyShow a

mkYesod "(Show a) => PolyShow a" [parseRoutes|
/ HomeR GET
|]

instance Show a => Yesod (PolyShow a)

getHomeR :: Show a => Handler a Html
getHomeR = do
    PolyShow x <- getYesod
    defaultLayout
        [whamlet|
            <p>
                Stub #{show x}
        |]