First of all, Value is a nicer name than Single.
However the main reason is to avoid error calls and to get better
feedback about the code from GHC. Because of the GHC bug #6124,
we had many calls to 'error' just to avoid spurious warnings. By
using data (instead of newtype) for Value we're able to avoid
them. This commit removes *19* error calls from Sql.hs that GHC
is now able to prove that are unreachable.
Instead of
select $ do
(x,y,z) <- from
where_ (z^.f ==. y^.f)
return (x, y^.f, z)
now you may write
select $
from $ \(x,y,z) -> do
where_ (z^.f ==. y^.f)
return (x, y^.f, z)
Now the only difference in reading order wrt. SQL is the return
on the bottom of the expression. =)
Note that this does not change at all the expressivity of the
language since
oldFrom = from return