Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Recommended DB layer? (harry)
2. Re: Recommended DB layer? (Erik de Castro Lopo)
3. Re: Recommended DB layer? (harry)
4. Re: Recommended DB layer? (Jeremy Shaw)
5. Re: Recommended DB layer? (Erik de Castro Lopo)
----------------------------------------------------------------------
Message: 1
Date: Sun, 16 Jun 2013 14:49:19 +0000 (UTC)
From: harry <[email protected]>
Subject: [Haskell-beginners] Recommended DB layer?
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
I've seen yesod-persistent described as "worst practices", e.g.
http://www.reddit.com/r/haskell/comments/1dk73s/web_frameworks_benchmark_4_includes_wai/c9rt80t.
Is this just a one-off poster, or do others agree with it? What are
considered best practices?
------------------------------
Message: 2
Date: Mon, 17 Jun 2013 06:40:52 +1000
From: Erik de Castro Lopo <[email protected]>
Subject: Re: [Haskell-beginners] Recommended DB layer?
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII
harry wrote:
> I've seen yesod-persistent described as "worst practices", e.g.
> http://www.reddit.com/r/haskell/comments/1dk73s/web_frameworks_benchmark_4_includes_wai/c9rt80t.
> Is this just a one-off poster, or do others agree with it? What are
> considered best practices?
I am a very experienced programmer (20+ years of coding, doing Haskell
since 2008) but had not done much with database before starting a
project with Yesod and Persistent. Obvioulsy I don't really know
what "best practices" are.
However, I have found Persistent along with Esqueleto a most pleasant
experience. My app is only targeting Postgresql. I did some reading
on database design, specifically about the importance of normailizing
the data. I then designed the the schema and started writing inserts
(using Persistent) and queries and updates (using Esqueleto). I am
100% certain that the type safety these languages of these interfaces
has prevented numerous bugs.
The only pain point has been breaking updates in the API causing me
to have to fix my code.
HTH,
Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
------------------------------
Message: 3
Date: Mon, 17 Jun 2013 07:02:51 +0000 (UTC)
From: harry <[email protected]>
Subject: Re: [Haskell-beginners] Recommended DB layer?
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
Erik de Castro Lopo <mle+hs <at> mega-nerd.com> writes:
> However, I have found Persistent along with Esqueleto a most pleasant
> experience. My app is only targeting Postgresql. I did some reading
> on database design, specifically about the importance of normailizing
> the data. I then designed the the schema and started writing inserts
> (using Persistent) and queries and updates (using Esqueleto). I am
> 100% certain that the type safety these languages of these interfaces
> has prevented numerous bugs.
Thanks for the heads up, I should give Esqueleto a look. The "lowest common
denominator" complaint did seem a bit strange to me, because it's exactly
what I'm used to doing in LINQ.
------------------------------
Message: 4
Date: Mon, 17 Jun 2013 03:05:14 -0500
From: Jeremy Shaw <[email protected]>
Subject: Re: [Haskell-beginners] Recommended DB layer?
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID:
<cage_jkbwv8906t9sfnrhrwgkkookjfszwd3xywgtgvmzwvv...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
I have not looked at persistent in AGES. So, my information is horribly out
of date. But I think the issue with 'lowest common denominator' is that it
means you can not exploit the useful power of the underlying database. For
example, I believe that at one point in time (no idea about right now),
persistent could not do SQL-level joins -- because not all backends could
support joins..
Now, for a vast majority of websites, that is not an issue -- because most
websites are lucky to get hundreds of hits *per day*. So, making it easier
to implement bug free code is a huge win! But, if you care a lot about
performance, then that could be a problem.
If persistent aims to be able to target wildly different backends, some of
which are not even SQL based, then it seems like it would hard for it to
also have optimal performance. Though, good enough performance for most
people is quite obtainable.
There are, of course, many other attempts to bring type-safe to database in
Haskell. Ranging from things that bind to SQL, like haskelldb, to native
persistance layers like acid-state. They all have their strengths and
weaknesses.
- jeremy
On Mon, Jun 17, 2013 at 2:02 AM, harry <[email protected]> wrote:
> Erik de Castro Lopo <mle+hs <at> mega-nerd.com> writes:
>
> > However, I have found Persistent along with Esqueleto a most pleasant
> > experience. My app is only targeting Postgresql. I did some reading
> > on database design, specifically about the importance of normailizing
> > the data. I then designed the the schema and started writing inserts
> > (using Persistent) and queries and updates (using Esqueleto). I am
> > 100% certain that the type safety these languages of these interfaces
> > has prevented numerous bugs.
>
> Thanks for the heads up, I should give Esqueleto a look. The "lowest common
> denominator" complaint did seem a bit strange to me, because it's exactly
> what I'm used to doing in LINQ.
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130617/f3382d4f/attachment-0001.htm>
------------------------------
Message: 5
Date: Mon, 17 Jun 2013 19:36:37 +1000
From: Erik de Castro Lopo <[email protected]>
Subject: Re: [Haskell-beginners] Recommended DB layer?
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII
Jeremy Shaw wrote:
> I have not looked at persistent in AGES. So, my information is horribly out
> of date. But I think the issue with 'lowest common denominator' is that it
> means you can not exploit the useful power of the underlying database. For
> example, I believe that at one point in time (no idea about right now),
> persistent could not do SQL-level joins -- because not all backends could
> support joins..
Queries written with Esqueleto support joins:
http://hackage.haskell.org/packages/archive/esqueleto/latest/doc/html/Database-Esqueleto.html
in a relatively elegant way.
> If persistent aims to be able to target wildly different backends, some of
> which are not even SQL based, then it seems like it would hard for it to
> also have optimal performance.
It is my understanding that esqueleto only supports SQL databases
Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 60, Issue 27
*****************************************