Commit Graph

25 Commits

Author SHA1 Message Date
Felipe Lessa
a5b93ff329 Typo. 2012-09-06 10:58:13 -03:00
Felipe Lessa
da6a669366 Add warning about unsupported JOINs to from's docs. 2012-09-06 10:40:39 -03:00
Felipe Lessa
4822172a42 Haddock fix. 2012-09-06 10:37:20 -03:00
Felipe Lessa
25f632398d Better top-level docs for internal modules. 2012-09-06 10:35:55 -03:00
Felipe Lessa
17a2cb65a9 Haddock fixes. 2012-09-06 09:49:14 -03:00
Felipe Lessa
1cb5c19288 Better 'from' documentation. 2012-09-06 09:46:08 -03:00
Felipe Lessa
f718be86da Instead of using rawSql's Single, use a new data type Value.
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.
2012-09-06 01:40:52 -03:00
Felipe Lessa
cc72ee9811 Misleading fixity declaration. 2012-09-06 01:28:06 -03:00
Felipe Lessa
077458ad56 Typos. 2012-09-06 01:27:34 -03:00
Felipe Lessa
df63cd864b COUNT(*). 2012-09-05 23:18:56 -03:00
Felipe Lessa
0f677e9246 Add UPDATE support. 2012-09-05 23:09:02 -03:00
Felipe Lessa
f5c046775a Generalize types of numerical operations.
Persistent doesn't ask for Num and everything has
worked very well so far.  Not having a Num constraint
also allows those operations to work on Maybes.
2012-09-05 22:57:16 -03:00
Felipe Lessa
3f2f1fdea7 Avoid a lot of redundant parenthesis.
Although this commit should not change the behaviour of any code,
it does make the resulting SQL a lot more pleasant to the eye.
2012-09-05 20:45:35 -03:00
Felipe Lessa
dad271a75a Prettify LANGUAGE pragmas. 2012-09-05 19:16:28 -03:00
Felipe Lessa
9a24c7774c Allow SELECT DISTINCT queries as well. 2012-09-05 19:14:03 -03:00
Felipe Lessa
7bb68cc233 Allow any parenthesization of JOINs. 2012-09-05 15:55:59 -03:00
Felipe Lessa
1e19d8625b Implement JOIN and ON clauses. Also add (?.). 2012-09-05 15:38:14 -03:00
Felipe Lessa
80d60bb9b6 Avoid using capitalized "Esqueleto" when referring to the library. 2012-09-04 18:37:02 -03:00
Felipe Lessa
31b4b0669f orderBy, asc, desc. 2012-09-04 18:12:40 -03:00
Felipe Lessa
c601613162 isNothing, just, nothing. 2012-09-04 18:12:25 -03:00
Felipe Lessa
670eebbc96 fromSingle is internal. 2012-09-03 23:13:19 -03:00
Felipe Lessa
2986d0996e Nicer 'from' interface.
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
2012-09-03 17:03:07 -03:00
Felipe Lessa
33d04d5f27 Implement sub. 2012-09-03 15:57:20 -03:00
Felipe Lessa
aba36832f6 Second prototype, now using finally tagless style. 2012-09-03 15:42:28 -03:00
Felipe Lessa
acc119e61f Initial skeleton. 2012-09-03 11:38:22 -03:00