Skip to content

Commit

Permalink
Merge pull request #1657 from simonmichael/master
Browse files Browse the repository at this point in the history
support template-haskell 2.16, build with GHC 8.10
  • Loading branch information
snoyberg committed Jan 27, 2020
2 parents 873bee0 + dd649bf commit 6c9279c
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions yesod-core/src/Yesod/Routes/TH/RenderRoute.hs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ mkRenderRouteClauses =
let cons y ys = InfixE (Just y) colon (Just ys)
let pieces' = foldr cons (VarE a) piecesSingle

let body = LamE [TupP [VarP a, VarP b]] (TupE [pieces', VarE b]) `AppE` (rr `AppE` VarE child)
let body = LamE [TupP [VarP a, VarP b]] (TupE
#if MIN_VERSION_template_haskell(2,16,0)
$ map Just
#endif
[pieces', VarE b]
) `AppE` (rr `AppE` VarE child)

return $ Clause [pat] (NormalB body) [FunD childRender childClauses]

Expand Down Expand Up @@ -119,11 +124,20 @@ mkRenderRouteClauses =
let cons y ys = InfixE (Just y) colon (Just ys)
let pieces = foldr cons (VarE a) piecesSingle

return $ LamE [TupP [VarP a, VarP b]] (TupE [pieces, VarE b]) `AppE` (rr `AppE` VarE x)
return $ LamE [TupP [VarP a, VarP b]] (TupE
#if MIN_VERSION_template_haskell(2,16,0)
$ map Just
#endif
[pieces, VarE b]
) `AppE` (rr `AppE` VarE x)
_ -> do
colon <- [|(:)|]
let cons a b = InfixE (Just a) colon (Just b)
return $ TupE [foldr cons piecesMulti piecesSingle, ListE []]
return $ TupE
#if MIN_VERSION_template_haskell(2,16,0)
$ map Just
#endif
[foldr cons piecesMulti piecesSingle, ListE []]

return $ Clause [pat] (NormalB body) []

Expand Down

0 comments on commit 6c9279c

Please sign in to comment.