erisco 2017-02-04 15:47:51
oh joy... both Type.Family.Nat and Data.Type.Natural
noan 2017-02-04 15:49:15
:D
noan 2017-02-04 15:54:16
Why is my brain unable to comprehend how to structure these so they just compose later the DB provided only when a query actually needs to run?
noan 2017-02-04 15:54:35
Damn you 4am! (This is all persistent stuff=
EvanR 2017-02-04 15:55:23
well, what is making you have to have a db
erisco 2017-02-04 15:55:44
I was going to say something but figured EvanR would speak up :P
noan 2017-02-04 15:56:20
I think I'm just braindead right now and not yet understanding persistent mostly. I'm not sure what type I need to construct to be able to later be like Okay you servant handler, here's a handler or something to the DB lookup you need. You know what to do.
noan 2017-02-04 15:56:26
Or something. Maybe I should just sleep
EvanR 2017-02-04 15:56:30
i havent used persistent so i might not have any clue
erisco 2017-02-04 15:58:04
I'm usually for express and interpret
erisco 2017-02-04 15:58:19
so I just say things like "all blog posts" and I interpret this later as a database query
EvanR 2017-02-04 15:59:10
right, but since its persistent i wonder if theres something already setup for that
erisco 2017-02-04 15:59:17
could be, don't know
Welkin 2017-02-04 16:00:29
something set up for what in Persistent?
Welkin 2017-02-04 16:00:44
you could always check the yesod book
erisco 2017-02-04 16:00:56
when you do things this way they always decouple, but it takes work to define and implement
Welkin 2017-02-04 16:00:58
Persistent has lots of secrets
erisco 2017-02-04 16:01:53
when you're working with the data you're probably just interested in the data itself and not making database queries
erisco 2017-02-04 16:02:23
so "display all blog posts" rather than "open database connection, prepare query, execute query, hydrate blog posts, display blog posts, close database connection"
EvanR 2017-02-04 16:03:00
repeat ad infinitum
erisco 2017-02-04 16:03:04
what you're really trying to do gets lost in the noise of making it happen
Welkin 2017-02-04 16:03:08
that is the pooint of an ORM
noan 2017-02-04 16:05:32
Right now I'm to wrap my head around essentially how I can go from String -> (something like) Handler Maybe User
noan 2017-02-04 16:05:49
https://github.com/parsonsmatt/servant-persistent/blob/master/src/Config.hs
noan 2017-02-04 16:05:58
Found an example of someone putting servant and persistent together though.
noan 2017-02-04 16:06:17
This looks like it may be what I needed.
Welkin 2017-02-04 16:06:41
you write a runDB function
Welkin 2017-02-04 16:06:48
you can take cues form yesod in that regard
Welkin 2017-02-04 16:06:53
from*
noan 2017-02-04 16:08:46
https://github.com/parsonsmatt/servant-persistent/blob/98479a423609794ffa9b668b0ae13ae9a57be18e/src/Models.hs
noan 2017-02-04 16:08:47
fancy
noan 2017-02-04 16:09:13
okay, I'll learn my way around this example Matt wrote. Looks fairly well thought out from what I can tell
Welkin 2017-02-04 16:09:58
yes
Welkin 2017-02-04 16:10:07
he didn't do anything but copy yesod
Welkin 2017-02-04 16:13:03
damn you purescript, confusing me with your *slightly* different syntax that makes me think I am reading haskell
erisco 2017-02-04 16:15:21
solve for one program which is valid in three languages and has distinct output
erisco 2017-02-04 16:17:17
is singleton-esque supposed to mean singletons but but the singletons package?
Welkin 2017-02-04 16:20:24
purescript even inherited syntax mistakes from haskell o.o
Welkin 2017-02-04 16:20:34
which leads to a big "wtf?" moment
Welkin 2017-02-04 16:20:45
:: instead of : for "has type"
Welkin 2017-02-04 16:20:52
at least idris fixed that...
erisco 2017-02-04 16:21:07
is that really a mistake?
Welkin 2017-02-04 16:21:12
yes
Welkin 2017-02-04 16:21:36
:: is cons
erisco 2017-02-04 16:21:54
seems more a style preference to me
Welkin 2017-02-04 16:22:05
the only reason they were swapped for haskell was because someone had the idea that "we'll be writing list cons more often that type signatures"
Welkin 2017-02-04 16:22:08
which is obviously wrong
erisco 2017-02-04 16:25:15
why do I feel like I am going to end up with a third library that does all these things
erisco 2017-02-04 16:25:23
writing one, that is
erisco 2017-02-04 16:25:39
how else do you resolve the fragmentation
erisco 2017-02-04 16:27:11
somehow Data.Type.Fin ended up with UndecidableInstances
erisco 2017-02-04 16:27:20
this is just not necessary -.-
erisco 2017-02-04 16:33:42
jle`, certainly one advantage of uses contexts is they are supplied implicitly
erisco 2017-02-04 16:33:54
parameters on the other hand are always going to be explicit