Understanding bind in template haskell

Yotam Ohad yotam2206 at gmail.com
Sat Dec 8 11:29:42 UTC 2018


Hi,
In the function DsMeta.repE there is a format being repeated:
For example in:

repE e@(ExplicitTuple _ es boxed)
  | not (all tupArgPresent es) = notHandled "Tuple sections" (ppr e)
  | isBoxed boxed = do { xs <- repLEs [e | (dL->L _ (Present _ e)) <- es]
                       ; repTup xs }
  | otherwise     = do { xs <- repLEs [e | (dL->L _ (Present _ e)) <- es]
                       ; repUnboxedTup xs }

There is  `(dL->L _ (Present _ e)) <- es`. I don't understand how this type
checks correctly.
If I'll try to do

 data Foo a = Foo a
runQ [| Foo b <- Foo 1 |]

in ghciI get an error. What is the difference?

Yotam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20181208/099e82a1/attachment.html>


More information about the ghc-devs mailing list