Skip to content

Commit

Permalink
Fix some problems with the tutorial template. Small improvements to snap
Browse files Browse the repository at this point in the history
binary code.
  • Loading branch information
mightybyte committed Oct 27, 2011
1 parent 56c87f2 commit f91fa03
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion project_template/tutorial/foo.cabal
Expand Up @@ -12,13 +12,14 @@ Cabal-version: >=1.2

Executable projname
hs-source-dirs: src
main-is: Main.hs
main-is: Tutorial.lhs

Build-depends:
base >= 4 && < 5,
bytestring >= 0.9.1 && < 0.10,
MonadCatchIO-transformers >= 0.2.1 && < 0.3,
mtl >= 2 && < 3,
snap == 0.6.*,
snap-core == 0.6.*,
snap-server == 0.6.*

Expand Down
1 change: 1 addition & 0 deletions project_template/tutorial/log/placeholder
@@ -0,0 +1 @@
placeholder
2 changes: 1 addition & 1 deletion snap.cabal
Expand Up @@ -7,7 +7,7 @@ license-file: LICENSE
author: Ozgun Ataman, Doug Beardsley, Gregory Collins, Carl Howells, Chris Smith
maintainer: snap@snapframework.com
build-type: Simple
cabal-version: >= 1.6
cabal-version: >= 1.8
homepage: http://snapframework.com/
category: Web

Expand Down
4 changes: 2 additions & 2 deletions src/Snap/Starter.hs
Expand Up @@ -20,8 +20,8 @@ import Snap.StarterTH
------------------------------------------------------------------------------
-- Creates a value tDir :: ([String], [(String, String)])
buildData "tDirBareBones" "barebones"
buildData "tDirDefault" "default"
buildData "tDirTutorial" "tutorial"
buildData "tDirDefault" "default"
buildData "tDirTutorial" "tutorial"

------------------------------------------------------------------------------
usage :: String
Expand Down
10 changes: 5 additions & 5 deletions src/Snap/StarterTH.hs
Expand Up @@ -7,6 +7,7 @@ import Data.List
import Language.Haskell.TH
import Language.Haskell.TH.Syntax
import System.Directory.Tree
import System.FilePath
------------------------------------------------------------------------------


Expand All @@ -30,19 +31,18 @@ getDirs _ (Failed _ _) = []
-- encountered and a list of filenames and content strings.
readTree :: FilePath -> IO ([DirData], [FileData])
readTree dir = do
d <- readDirectory $ dir ++ "/."
d <- readDirectory $ dir </> "."
let ps = zipPaths $ "" :/ (free d)
fd = F.foldr (:) [] ps
dirs = tail . getDirs [] $ free d

return (dirs, fd)
dirs = getDirs [] $ free d
return (drop 1 dirs, fd)


------------------------------------------------------------------------------
-- Calls readTree and returns it's value in a quasiquote.
dirQ :: FilePath -> Q Exp
dirQ tplDir = do
d <- runIO . readTree $ "project_template/" ++ tplDir
d <- runIO . readTree $ "project_template" </> tplDir
lift d


Expand Down

0 comments on commit f91fa03

Please sign in to comment.