Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jwaldmann committed Mar 15, 2024
1 parent cae39c6 commit c17b989
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions xml-hamlet/Text/Hamlet/XML.hs
Original file line number Diff line number Diff line change
Expand Up @@ -151,22 +151,34 @@ docToExp scope (DocForall list idents inside) = do
let scope' = extraScope ++ scope
mh <- [|F.concatMap|]
inside' <- docsToExp scope' inside
#if MIN_VERSION_template_haskell(2,22,0)
let lam = LamE [VisAP pat] inside'
#else
let lam = LamE [pat] inside'
#endif
return $ mh `AppE` lam `AppE` list'
docToExp scope (DocWith [] inside) = docsToExp scope inside
docToExp scope (DocWith ((deref, idents):dis) inside) = do
let deref' = derefToExp scope deref
(pat, extraScope) <- bindingPattern idents
let scope' = extraScope ++ scope
inside' <- docToExp scope' (DocWith dis inside)
#if MIN_VERSION_template_haskell(2,22,0)
let lam = LamE [VisAP pat] inside'
#else
let lam = LamE [pat] inside'
#endif
return $ lam `AppE` deref'
docToExp scope (DocMaybe val idents inside mno) = do
let val' = derefToExp scope val
(pat, extraScope) <- bindingPattern idents
let scope' = extraScope ++ scope
inside' <- docsToExp scope' inside
#if MIN_VERSION_template_haskell(2,22,0)
let inside'' = LamE [VisAP pat] inside'
#else
let inside'' = LamE [pat] inside'
#endif
ninside' <- case mno of
Nothing -> [| [] |]
Just no -> docsToExp scope no
Expand Down

0 comments on commit c17b989

Please sign in to comment.