Merge branch 'ghc-9.2-compat' of https://github.com/TeofilC/yesod
This commit is contained in:
commit
60111462de
@ -16,6 +16,9 @@ import Distribution.PackageDescription.Parse (readGenericPackageDescription)
|
|||||||
#else
|
#else
|
||||||
import Distribution.PackageDescription.Parse (readPackageDescription)
|
import Distribution.PackageDescription.Parse (readPackageDescription)
|
||||||
#endif
|
#endif
|
||||||
|
#if MIN_VERSION_Cabal(3, 6, 0)
|
||||||
|
import Distribution.Utils.Path
|
||||||
|
#endif
|
||||||
import Distribution.PackageDescription.Configuration (flattenPackageDescription)
|
import Distribution.PackageDescription.Configuration (flattenPackageDescription)
|
||||||
import Distribution.PackageDescription (allBuildInfo, hsSourceDirs)
|
import Distribution.PackageDescription (allBuildInfo, hsSourceDirs)
|
||||||
import Distribution.Verbosity (normal)
|
import Distribution.Verbosity (normal)
|
||||||
@ -247,4 +250,8 @@ getSrcDir cabal = do
|
|||||||
#endif
|
#endif
|
||||||
let buildInfo = allBuildInfo pd
|
let buildInfo = allBuildInfo pd
|
||||||
srcDirs = concatMap hsSourceDirs buildInfo
|
srcDirs = concatMap hsSourceDirs buildInfo
|
||||||
|
#if MIN_VERSION_Cabal(3, 6, 0)
|
||||||
|
return $ maybe "." getSymbolicPath $ listToMaybe srcDirs
|
||||||
|
#else
|
||||||
return $ fromMaybe "." $ listToMaybe srcDirs
|
return $ fromMaybe "." $ listToMaybe srcDirs
|
||||||
|
#endif
|
||||||
|
|||||||
@ -1,5 +1,9 @@
|
|||||||
# ChangeLog for yesod-bin
|
# ChangeLog for yesod-bin
|
||||||
|
|
||||||
|
## 1.6.2.1
|
||||||
|
|
||||||
|
* Support Cabal 3.6 [#1754](https://github.com/yesodweb/yesod/pull/1754)
|
||||||
|
|
||||||
## 1.6.2
|
## 1.6.2
|
||||||
|
|
||||||
* aeson 2.0
|
* aeson 2.0
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-bin
|
name: yesod-bin
|
||||||
version: 1.6.2
|
version: 1.6.2.1
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
* Add missing list to documentation for ``Yesod.Core.Dispatch.warp``. [#1745](https://github.com/yesodweb/yesod/pull/1745)
|
* Add missing list to documentation for ``Yesod.Core.Dispatch.warp``. [#1745](https://github.com/yesodweb/yesod/pull/1745)
|
||||||
* Add instances for `ToContent Void`, `ToTypedContent Void`. [#1752](https://github.com/yesodweb/yesod/pull/1752)
|
* Add instances for `ToContent Void`, `ToTypedContent Void`. [#1752](https://github.com/yesodweb/yesod/pull/1752)
|
||||||
* Handle async exceptions within yesod rather then warp. [#1753](https://github.com/yesodweb/yesod/pull/1753)
|
* Handle async exceptions within yesod rather then warp. [#1753](https://github.com/yesodweb/yesod/pull/1753)
|
||||||
|
* Support template-haskell 2.18 [#1754](https://github.com/yesodweb/yesod/pull/1754)
|
||||||
|
|
||||||
## 1.6.21.0
|
## 1.6.21.0
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
{-# LANGUAGE CPP #-}
|
||||||
{-# LANGUAGE RecordWildCards, TemplateHaskell, ViewPatterns #-}
|
{-# LANGUAGE RecordWildCards, TemplateHaskell, ViewPatterns #-}
|
||||||
module Yesod.Routes.TH.Dispatch
|
module Yesod.Routes.TH.Dispatch
|
||||||
( MkDispatchSettings (..)
|
( MkDispatchSettings (..)
|
||||||
@ -73,7 +74,7 @@ mkDispatchClause MkDispatchSettings {..} resources = do
|
|||||||
handlePiece (Static str) = return (LitP $ StringL str, Nothing)
|
handlePiece (Static str) = return (LitP $ StringL str, Nothing)
|
||||||
handlePiece (Dynamic _) = do
|
handlePiece (Dynamic _) = do
|
||||||
x <- newName "dyn"
|
x <- newName "dyn"
|
||||||
let pat = ViewP (VarE 'fromPathPiece) (ConP 'Just [VarP x])
|
let pat = ViewP (VarE 'fromPathPiece) (conPCompat 'Just [VarP x])
|
||||||
return (pat, Just $ VarE x)
|
return (pat, Just $ VarE x)
|
||||||
|
|
||||||
handlePieces :: [Piece a] -> Q ([Pat], [Exp])
|
handlePieces :: [Piece a] -> Q ([Pat], [Exp])
|
||||||
@ -86,7 +87,7 @@ mkDispatchClause MkDispatchSettings {..} resources = do
|
|||||||
mkPathPat final =
|
mkPathPat final =
|
||||||
foldr addPat final
|
foldr addPat final
|
||||||
where
|
where
|
||||||
addPat x y = ConP '(:) [x, y]
|
addPat x y = conPCompat '(:) [x, y]
|
||||||
|
|
||||||
go :: SDC -> ResourceTree a -> Q Clause
|
go :: SDC -> ResourceTree a -> Q Clause
|
||||||
go sdc (ResourceParent name _check pieces children) = do
|
go sdc (ResourceParent name _check pieces children) = do
|
||||||
@ -124,11 +125,11 @@ mkDispatchClause MkDispatchSettings {..} resources = do
|
|||||||
Methods multi methods -> do
|
Methods multi methods -> do
|
||||||
(finalPat, mfinalE) <-
|
(finalPat, mfinalE) <-
|
||||||
case multi of
|
case multi of
|
||||||
Nothing -> return (ConP '[] [], Nothing)
|
Nothing -> return (conPCompat '[] [], Nothing)
|
||||||
Just _ -> do
|
Just _ -> do
|
||||||
multiName <- newName "multi"
|
multiName <- newName "multi"
|
||||||
let pat = ViewP (VarE 'fromPathMultiPiece)
|
let pat = ViewP (VarE 'fromPathMultiPiece)
|
||||||
(ConP 'Just [VarP multiName])
|
(conPCompat 'Just [VarP multiName])
|
||||||
return (pat, Just $ VarE multiName)
|
return (pat, Just $ VarE multiName)
|
||||||
|
|
||||||
let dynsMulti =
|
let dynsMulti =
|
||||||
@ -200,3 +201,10 @@ mkDispatchClause MkDispatchSettings {..} resources = do
|
|||||||
defaultGetHandler :: Maybe String -> String -> Q Exp
|
defaultGetHandler :: Maybe String -> String -> Q Exp
|
||||||
defaultGetHandler Nothing s = return $ VarE $ mkName $ "handle" ++ s
|
defaultGetHandler Nothing s = return $ VarE $ mkName $ "handle" ++ s
|
||||||
defaultGetHandler (Just method) s = return $ VarE $ mkName $ map toLower method ++ s
|
defaultGetHandler (Just method) s = return $ VarE $ mkName $ map toLower method ++ s
|
||||||
|
|
||||||
|
conPCompat :: Name -> [Pat] -> Pat
|
||||||
|
conPCompat n pats = ConP n
|
||||||
|
#if MIN_VERSION_template_haskell(2,18,0)
|
||||||
|
[]
|
||||||
|
#endif
|
||||||
|
pats
|
||||||
|
|||||||
@ -67,7 +67,7 @@ mkRenderRouteClauses =
|
|||||||
let cnt = length $ filter isDynamic pieces
|
let cnt = length $ filter isDynamic pieces
|
||||||
dyns <- replicateM cnt $ newName "dyn"
|
dyns <- replicateM cnt $ newName "dyn"
|
||||||
child <- newName "child"
|
child <- newName "child"
|
||||||
let pat = ConP (mkName name) $ map VarP $ dyns ++ [child]
|
let pat = conPCompat (mkName name) $ map VarP $ dyns ++ [child]
|
||||||
|
|
||||||
pack' <- [|pack|]
|
pack' <- [|pack|]
|
||||||
tsp <- [|toPathPiece|]
|
tsp <- [|toPathPiece|]
|
||||||
@ -100,7 +100,7 @@ mkRenderRouteClauses =
|
|||||||
case resourceDispatch res of
|
case resourceDispatch res of
|
||||||
Subsite{} -> return <$> newName "sub"
|
Subsite{} -> return <$> newName "sub"
|
||||||
_ -> return []
|
_ -> return []
|
||||||
let pat = ConP (mkName $ resourceName res) $ map VarP $ dyns ++ sub
|
let pat = conPCompat (mkName $ resourceName res) $ map VarP $ dyns ++ sub
|
||||||
|
|
||||||
pack' <- [|pack|]
|
pack' <- [|pack|]
|
||||||
tsp <- [|toPathPiece|]
|
tsp <- [|toPathPiece|]
|
||||||
@ -182,3 +182,10 @@ notStrict = Bang NoSourceUnpackedness NoSourceStrictness
|
|||||||
|
|
||||||
instanceD :: Cxt -> Type -> [Dec] -> Dec
|
instanceD :: Cxt -> Type -> [Dec] -> Dec
|
||||||
instanceD = InstanceD Nothing
|
instanceD = InstanceD Nothing
|
||||||
|
|
||||||
|
conPCompat :: Name -> [Pat] -> Pat
|
||||||
|
conPCompat n pats = ConP n
|
||||||
|
#if MIN_VERSION_template_haskell(2,18,0)
|
||||||
|
[]
|
||||||
|
#endif
|
||||||
|
pats
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
{-# LANGUAGE CPP #-}
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
{-# LANGUAGE RecordWildCards #-}
|
||||||
module Yesod.Routes.TH.RouteAttrs
|
module Yesod.Routes.TH.RouteAttrs
|
||||||
@ -26,7 +27,11 @@ goTree front (ResourceParent name _check pieces trees) =
|
|||||||
toIgnore = length $ filter isDynamic pieces
|
toIgnore = length $ filter isDynamic pieces
|
||||||
isDynamic Dynamic{} = True
|
isDynamic Dynamic{} = True
|
||||||
isDynamic Static{} = False
|
isDynamic Static{} = False
|
||||||
front' = front . ConP (mkName name) . ignored
|
front' = front . ConP (mkName name)
|
||||||
|
#if MIN_VERSION_template_haskell(2,18,0)
|
||||||
|
[]
|
||||||
|
#endif
|
||||||
|
. ignored
|
||||||
|
|
||||||
goRes :: (Pat -> Pat) -> Resource a -> Q Clause
|
goRes :: (Pat -> Pat) -> Resource a -> Q Clause
|
||||||
goRes front Resource {..} =
|
goRes front Resource {..} =
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user