1{-# LANGUAGE QuasiQuotes, TypeFamilies, MultiParamTypeClasses #-} 2{-# LANGUAGE TemplateHaskell #-} 3import Yesod.Static 4import Yesod.Core 5import Network.Wai.Handler.Warp (run) 6import Network.Wai.Application.Static 7 8staticFiles "." 9 10data Sample = Sample { getStatic :: Static } 11 12--getStatic _ = Static $ defaultFileServerSettings { ssFolder = fileSystemLookup $ toFilePath "." } 13mkYesod "Sample" [parseRoutes| 14/ RootR GET 15/static StaticR Static getStatic 16|] 17instance Yesod Sample where 18 19getRootR = do 20 redirect "static" 21 return () 22 23main = do 24 s <- static "." 25 toWaiApp (Sample s) >>= run 3000 26