yesod-routes stuff for android build

This commit is contained in:
Joey Hess 2013-04-15 21:02:33 -04:00
parent ed180036d5
commit 02459e4c66
3 changed files with 52 additions and 92 deletions

View file

@ -174,7 +174,7 @@ android: Build/EvilSplicer
# and not overwritten.)
cp -uR tmp/splices/* tmp/androidtree
# Some additional dependencies needed by the expanded splices.
sed -i 's/^ Build-Depends: / Build-Depends: yesod-core, shakespeare-css, shakespeare-js, shakespeare, blaze-markup, /' tmp/androidtree/git-annex.cabal
sed -i 's/^ Build-Depends: / Build-Depends: yesod-routes, yesod-core, shakespeare-css, shakespeare-js, shakespeare, blaze-markup, /' tmp/androidtree/git-annex.cabal
# cabal cannot cross compile with custom build type, so workaround
sed -i 's/Build-type: Custom/Build-type: Simple/' tmp/androidtree/git-annex.cabal
if [ ! -e tmp/androidtree/dist/setup/setup ]; then \

View file

@ -14,6 +14,7 @@ import qualified Text.Css
import qualified "blaze-markup" Text.Blaze.Internal
import qualified Data.Monoid
import qualified Yesod.Widget
import qualified Yesod.Routes.TH.Types
{- End EvilSplicer headers. -}

View file

@ -1,21 +1,20 @@
From bf9b294fd3a4ae4e550844504f3ac4ed0dc226c0 Mon Sep 17 00:00:00 2001
From 06176b0f3dbbe559490f0971e0db205287793286 Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@kitenet.net>
Date: Thu, 28 Feb 2013 23:40:44 -0400
Subject: [PATCH] remove TH (hack job)
Date: Mon, 15 Apr 2013 21:01:12 -0400
Subject: [PATCH] remove TH and export module used by TH splices
---
Yesod/Routes/Overlap.hs | 74 ----------
Yesod/Routes/Parse.hs | 115 ---------------
Yesod/Routes/TH.hs | 12 --
Yesod/Routes/TH/Dispatch.hs | 344 -------------------------------------------
Yesod/Routes/TH/Types.hs | 84 -----------
yesod-routes.cabal | 22 ---
6 files changed, 651 deletions(-)
Yesod/Routes/Overlap.hs | 74 ----------
Yesod/Routes/Parse.hs | 115 ---------------
Yesod/Routes/TH.hs | 12 --
Yesod/Routes/TH/Dispatch.hs | 344 --------------------------------------------
Yesod/Routes/TH/Types.hs | 16 ---
yesod-routes.cabal | 21 ---
6 files changed, 582 deletions(-)
delete mode 100644 Yesod/Routes/Overlap.hs
delete mode 100644 Yesod/Routes/Parse.hs
delete mode 100644 Yesod/Routes/TH.hs
delete mode 100644 Yesod/Routes/TH/Dispatch.hs
delete mode 100644 Yesod/Routes/TH/Types.hs
diff --git a/Yesod/Routes/Overlap.hs b/Yesod/Routes/Overlap.hs
deleted file mode 100644
@ -587,100 +586,58 @@ index a52f69a..0000000
- isDynamic _ = False
- here = map VarE here' ++ [routeFromDynamics rest name ys']
diff --git a/Yesod/Routes/TH/Types.hs b/Yesod/Routes/TH/Types.hs
deleted file mode 100644
index 52cd446..0000000
index 52cd446..18208d3 100644
--- a/Yesod/Routes/TH/Types.hs
+++ /dev/null
@@ -1,84 +0,0 @@
-{-# LANGUAGE TemplateHaskell #-}
-module Yesod.Routes.TH.Types
- ( -- * Data types
- Resource (..)
- , ResourceTree (..)
- , Piece (..)
- , Dispatch (..)
- , CheckOverlap
- -- ** Helper functions
- , resourceMulti
- , resourceTreePieces
- , resourceTreeName
- ) where
-
-import Language.Haskell.TH.Syntax
-import Control.Arrow (second)
-
-data ResourceTree typ = ResourceLeaf (Resource typ) | ResourceParent String [(CheckOverlap, Piece typ)] [ResourceTree typ]
-
-resourceTreePieces :: ResourceTree typ -> [(CheckOverlap, Piece typ)]
-resourceTreePieces (ResourceLeaf r) = resourcePieces r
-resourceTreePieces (ResourceParent _ x _) = x
-
-resourceTreeName :: ResourceTree typ -> String
-resourceTreeName (ResourceLeaf r) = resourceName r
-resourceTreeName (ResourceParent x _ _) = x
-
-instance Functor ResourceTree where
- fmap f (ResourceLeaf r) = ResourceLeaf (fmap f r)
- fmap f (ResourceParent a b c) = ResourceParent a (map (second $ fmap f) b) $ map (fmap f) c
-
+++ b/Yesod/Routes/TH/Types.hs
@@ -29,10 +29,6 @@ instance Functor ResourceTree where
fmap f (ResourceLeaf r) = ResourceLeaf (fmap f r)
fmap f (ResourceParent a b c) = ResourceParent a (map (second $ fmap f) b) $ map (fmap f) c
-instance Lift t => Lift (ResourceTree t) where
- lift (ResourceLeaf r) = [|ResourceLeaf $(lift r)|]
- lift (ResourceParent a b c) = [|ResourceParent $(lift a) $(lift b) $(lift c)|]
-
-data Resource typ = Resource
- { resourceName :: String
- , resourcePieces :: [(CheckOverlap, Piece typ)]
- , resourceDispatch :: Dispatch typ
- }
- deriving Show
-
-type CheckOverlap = Bool
-
-instance Functor Resource where
- fmap f (Resource a b c) = Resource a (map (second $ fmap f) b) (fmap f c)
-
data Resource typ = Resource
{ resourceName :: String
, resourcePieces :: [(CheckOverlap, Piece typ)]
@@ -45,9 +41,6 @@ type CheckOverlap = Bool
instance Functor Resource where
fmap f (Resource a b c) = Resource a (map (second $ fmap f) b) (fmap f c)
-instance Lift t => Lift (Resource t) where
- lift (Resource a b c) = [|Resource $(lift a) $(lift b) $(lift c)|]
-
-data Piece typ = Static String | Dynamic typ
- deriving Show
-
-instance Functor Piece where
- fmap _ (Static s) = (Static s)
- fmap f (Dynamic t) = Dynamic (f t)
-
data Piece typ = Static String | Dynamic typ
deriving Show
@@ -55,10 +48,6 @@ instance Functor Piece where
fmap _ (Static s) = (Static s)
fmap f (Dynamic t) = Dynamic (f t)
-instance Lift t => Lift (Piece t) where
- lift (Static s) = [|Static $(lift s)|]
- lift (Dynamic t) = [|Dynamic $(lift t)|]
-
-data Dispatch typ =
- Methods
- { methodsMulti :: Maybe typ -- ^ type of the multi piece at the end
- , methodsMethods :: [String] -- ^ supported request methods
- }
- | Subsite
- { subsiteType :: typ
- , subsiteFunc :: String
- }
- deriving Show
-
-instance Functor Dispatch where
- fmap f (Methods a b) = Methods (fmap f a) b
- fmap f (Subsite a b) = Subsite (f a) b
-
data Dispatch typ =
Methods
{ methodsMulti :: Maybe typ -- ^ type of the multi piece at the end
@@ -74,11 +63,6 @@ instance Functor Dispatch where
fmap f (Methods a b) = Methods (fmap f a) b
fmap f (Subsite a b) = Subsite (f a) b
-instance Lift t => Lift (Dispatch t) where
- lift (Methods Nothing b) = [|Methods Nothing $(lift b)|]
- lift (Methods (Just t) b) = [|Methods (Just $(lift t)) $(lift b)|]
- lift (Subsite t b) = [|Subsite $(lift t) $(lift b)|]
-
-resourceMulti :: Resource typ -> Maybe typ
-resourceMulti Resource { resourceDispatch = Methods (Just t) _ } = Just t
-resourceMulti _ = Nothing
resourceMulti :: Resource typ -> Maybe typ
resourceMulti Resource { resourceDispatch = Methods (Just t) _ } = Just t
resourceMulti _ = Nothing
diff --git a/yesod-routes.cabal b/yesod-routes.cabal
index eb367b3..0984dfe 100644
index eb367b3..dc6a12c 100644
--- a/yesod-routes.cabal
+++ b/yesod-routes.cabal
@@ -23,29 +23,7 @@ library
@@ -23,31 +23,10 @@ library
, path-pieces >= 0.1 && < 0.2
exposed-modules: Yesod.Routes.Dispatch
@ -690,9 +647,9 @@ index eb367b3..0984dfe 100644
- Yesod.Routes.Overlap
- other-modules: Yesod.Routes.TH.Dispatch
- Yesod.Routes.TH.RenderRoute
- Yesod.Routes.TH.Types
- ghc-options: -Wall
-
Yesod.Routes.TH.Types
ghc-options: -Wall
-test-suite runtests
- type: exitcode-stdio-1.0
- main-is: main.hs
@ -707,9 +664,11 @@ index eb367b3..0984dfe 100644
- , containers
- , template-haskell
- , path-pieces
ghc-options: -Wall
- ghc-options: -Wall
-
source-repository head
type: git
location: https://github.com/yesodweb/yesod
--
1.7.10.4
1.8.2.rc3