Permalink
Browse files

Fix some problems with the tutorial template. Small improvements to snap

binary code.
  • Loading branch information...
1 parent 56c87f2 commit f91fa037c86f4233e24fefb51b41b5d704c9be69 @mightybyte mightybyte committed Oct 27, 2011
Showing with 11 additions and 9 deletions.
  1. +2 −1 project_template/tutorial/foo.cabal
  2. +1 −0 project_template/tutorial/log/placeholder
  3. +1 −1 snap.cabal
  4. +2 −2 src/Snap/Starter.hs
  5. +5 −5 src/Snap/StarterTH.hs
@@ -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.*
@@ -0,0 +1 @@
+placeholder
View
@@ -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
View
@@ -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
View
@@ -7,6 +7,7 @@ import Data.List
import Language.Haskell.TH
import Language.Haskell.TH.Syntax
import System.Directory.Tree
+import System.FilePath
------------------------------------------------------------------------------
@@ -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

0 comments on commit f91fa03

Please sign in to comment.