Created
October 2, 2011 09:56
-
-
Save Tarrasch/1257291 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TypeFamilies, QuasiQuotes, OverloadedStrings, MultiParamTypeClasses, TemplateHaskell #-} | |
{-# LANGUAGE GADTs #-} | |
import Yesod | |
import Control.Applicative | |
import qualified Data.Text as T | |
import Data.Text (Text) | |
class YesodSlug site table where | |
type Slug table | |
slug :: table -> Text | |
--------- Example usage | |
data MySite = MySite | |
getRootR = defaultLayout $ addHamlet [hamlet| hello |] | |
mkYesod "MySite" [parseRoutes| | |
/ RootR GET | |
|] | |
share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persist| | |
BlogPost | |
title Text | |
slug Text | |
UniqueSlug slug | |
|] | |
instance Yesod MySite where approot _ = "" | |
main = warpDebug 3000 MySite |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment