Search Haskell Channel Logs

Sunday, January 29, 2017

#haskell channel featuring Axman6, orzo, dfeuer, monochrom, buglebudabey, ertes,

ertes 2017-01-29 14:47:59
fragamus: postgresql-simple is probably the highest-level API that is still just a postgresql binding
Axman6 2017-01-29 14:48:45
it's quite pleasant to use too. though I'm now leaning towards hasql whenever I need postgresql
ertes 2017-01-29 14:49:34
"The API is completely disinfected from exceptions. All error-reporting is explicit and is presented using the Either type."
ertes 2017-01-29 14:49:42
that sounds like it gets old… fast…
Axman6 2017-01-29 14:50:05
hasql needs a bit more abstraction though, no monat transformers, all explicitly in IO
Axman6 2017-01-29 14:50:31
monad*
orzo 2017-01-29 14:51:12
why would you want transformers
orzo 2017-01-29 14:51:42
im wokring on a code base where somebody thought they should make type classes and transformers for everything
ertes 2017-01-29 14:51:47
oh god, no… another one of those "arrows for the sake of arrows" libraries
orzo 2017-01-29 14:51:49
and i think they went overboard
Axman6 2017-01-29 14:52:09
ertes: you don't have to use arrows
ertes 2017-01-29 14:52:23
no? Query is an arrow
Axman6 2017-01-29 14:52:25
it's also got profunctor and category instances, which are equivalent in power but less painful
ertes 2017-01-29 14:52:39
that's not the point… it's just stupid not to make this a regular monad
monochrom 2017-01-29 14:52:53
orzo: Sometimes I appreciate ParsecT as a monad transformer, for example. But yeah some people go overboard.
ertes 2017-01-29 14:53:11
and it can't even excuse itself with "history" or "experiment" the way hxt could
monochrom 2017-01-29 14:54:04
:)
Axman6 2017-01-29 14:54:31
the queries aren't what need to be a Monad, Sessions are, and they are a monad
ertes 2017-01-29 14:54:42
Query is an ArrowApply
Axman6 2017-01-29 14:54:43
you appear to be complaining about a library you on't understand yet ;)
ertes 2017-01-29 14:54:53
in other words: it's a monad
monochrom 2017-01-29 14:55:13
I am with ertes when it comes to "it is already an ArrowApply".
ertes 2017-01-29 14:55:26
the fact that it provides an Arrow/Profunctor interface means that you have to use awkward combinators or awkward syntax *for no reason*
monochrom 2017-01-29 14:55:49
I chip in one more point: do-block usually gives you more efficient code than proc-block.
ertes 2017-01-29 14:56:08
exactly… ArrowApply is worse than Monad in every way i can imagine
Axman6 2017-01-29 14:56:23
Query a b = Query (Kleisli (ReaderT Connection.Connection (EitherT Decoders.Results.Error IO)) a b) (so it appears it could be a monad?
Axman6 2017-01-29 14:57:22
my experience has been I haven't needed to compose Queries anyway, it's Sessions I usually compose which is the result of running a Query
ertes 2017-01-29 14:58:20
sure… it's just that it immediately makes me question the whole thing
Axman6 2017-01-29 14:58:25
anyway, what I want to see if a MonadHasql m with run :: Session a -> m a (it would basically just be a specialised Reader over Connection and with MonadIO
monochrom 2017-01-29 14:59:34
If no one has ever composed Query's. then it need not be even Arrow.
monochrom 2017-01-29 14:59:40
nor Category.
dfeuer 2017-01-29 15:00:11
Hi ertes, monochrom.
Axman6 2017-01-29 15:00:14
_I_ haven't, I'm sure others probably have. clearly someone has as the example shows how to do it
monochrom 2017-01-29 15:00:18
But as soon as someone wants to compose Query's, it's a slippery slope, they will quickly crave for the full Monad power.
ertes 2017-01-29 15:00:40
the thing that really baffles me is how one does even come to the conclusion: "i need an arrow here"
dfeuer 2017-01-29 15:00:50
ertes: I found an implementation of `fix` using lazy ST by Oleg, which is *one thing*, but I think we should have a few more.
monochrom 2017-01-29 15:01:17
Oh dfeuer you're in luck today!
Axman6 2017-01-29 15:01:28
ertes: I agree, but again, you _do not need to use arrow in any way to use the library_
ertes 2017-01-29 15:01:29
dfeuer: i'm struggling to add arrays
monochrom 2017-01-29 15:01:32
marvel at my http://lpaste.net/5545157388815826944
ertes 2017-01-29 15:01:41
dfeuer: so far it's an STRef fest
monochrom 2017-01-29 15:02:18
Also Oleg already has 3 other fix'es. Using types or Dynamic.
monochrom 2017-01-29 15:02:47
URL is at the bottom of mine.
ertes 2017-01-29 15:03:06
dfeuer: do you think complicated networks of STRefs would be good enough?
ertes 2017-01-29 15:03:35
as a test case i mean
dfeuer 2017-01-29 15:04:09
ertes: I think that sounds awesome.
ertes 2017-01-29 15:04:25
alright
buglebudabey 2017-01-29 15:04:29
does anyone here have a hakyll site with a comment section for their posts?
dfeuer 2017-01-29 15:04:58
I don't think anything I've done could affect arrays but not STRefs, but I could be wrong.
Axman6 2017-01-29 15:05:02
buglebudabey: yes
buglebudabey 2017-01-29 15:05:12
Axman6 do you use disqus or something else
Axman6 2017-01-29 15:05:13
buglebudabey: I just use Disqus
buglebudabey 2017-01-29 15:05:17
ah ok
Axman6 2017-01-29 15:05:33
works quite well, for the one comment I've got so far =)
buglebudabey 2017-01-29 15:05:36
i was thinking about disqus, it seems easy enough, but part of me wants to own my comments
dfeuer 2017-01-29 15:05:39
monochrom: yes, he does; I'm only interested in the STRef one at the moment because I think the GHC test suite could use a few tests of lazy ST. Especially since I'm making non-trivial modifications to it.
Axman6 2017-01-29 15:05:57
means I can host everything on S3 behind CloudFront
monochrom 2017-01-29 15:05:58
Yes, now I remember ertes's message on haskell-cafe
dfeuer 2017-01-29 15:06:02
monochrom: if you have time for a code review, I'd certainly be appreciative.
buglebudabey 2017-01-29 15:06:09
Axman6 i have no clue what those are
dfeuer 2017-01-29 15:06:10
That was my message, I believe?
Axman6 2017-01-29 15:06:14
buglebudabey: kinda defeats the whole static site idea no?
buglebudabey 2017-01-29 15:06:28
Axman6 i don't mind doing some work if it's worth it
Axman6 2017-01-29 15:06:44
well, you'll need a web service too then
ertes 2017-01-29 15:06:47
dfeuer: if necessary it shouldn't be too difficult to shoehorn an array in somewhere
monochrom 2017-01-29 15:06:53
Yikes, your message yes.
dfeuer 2017-01-29 15:07:19
ertes: if you like; I'd be more interested if you can find a (preferably non-trivial) way to shoehorn fixST in.
buglebudabey 2017-01-29 15:07:22
Axman6 yeah i guess if it ever becomes popular enough it may make sense to switch but until then i guess disqus is alright, what would i do with comments i own anyway other than look at them
ertes 2017-01-29 15:07:28
dfeuer: yes, definitely
dfeuer 2017-01-29 15:07:33
Woohoo.
Axman6 2017-01-29 15:07:44
(S3 is Amazon's simple storage service, it's amazon's file storage and static file hosting service, CloudFront is their content distribution network)
dfeuer 2017-01-29 15:07:58
ertes: do you have a guess as to how long this might take? Are we talking minutes/hours/days/weeks?
buglebudabey 2017-01-29 15:08:00
Axman6 ah i just host mine with github
buglebudabey 2017-01-29 15:08:49
ertes dfeuer i haven't heard this term shoehorn used this way, what do you mean by it
ertes 2017-01-29 15:08:59
dfeuer: if you stick around for a while, you might see a working test case =)
dfeuer 2017-01-29 15:09:15
buglebudabey: a shoe horn is a device for cramming a foot into a shoe when it doesn't seem to fit.
buglebudabey 2017-01-29 15:09:27
well i know what a shoe horn is
buglebudabey 2017-01-29 15:09:31
but in this context
buglebudabey 2017-01-29 15:09:38
you mean to fit it into your code?
ertes 2017-01-29 15:09:38
buglebudabey: arrays are useless here, but i can use them anyway, if i want to… it's just not a proper use case for arrays
dfeuer 2017-01-29 15:09:38
Shoehorning is putting something in "by force" when it doesn't necessarily fit.
buglebudabey 2017-01-29 15:09:50
gotcha
buglebudabey 2017-01-29 15:10:09
i just don't wear dress shoes, never have to use a shoe horn now
buglebudabey 2017-01-29 15:10:28
weddings? sandals
dfeuer 2017-01-29 15:10:32
buglebudabey: I think this particular usage may be American slang.
orzo 2017-01-29 15:12:17
yeah, i know the slang shoehorn but never encountered or thought about it that there's an actual device called a shoe horn
monochrom 2017-01-29 15:16:06
Sometimes it is called bootstrap. And not the "boot up the OS" kind. Nor the "write the first Haskell compiler in history" kind.
orzo 2017-01-29 15:23:12
I have pattern (:->) defined in a module but when i try to import it with pattern (:->) syntax, it balks
orzo 2017-01-29 15:23:22
what's the right syntax for importing this?
monochrom 2017-01-29 15:23:48
Do you have enough number of parentheses?
orzo 2017-01-29 15:24:15
import Data.Wrapper.PSQ (PSQ, pattern (:->))
orzo 2017-01-29 15:24:44
is that high enough?
monochrom 2017-01-29 15:25:56
Let me read the user guide carefully. I am wonderng if they want PSQ((:->))
orzo 2017-01-29 15:26:36
but PSQ and :-> are not closely related
monochrom 2017-01-29 15:26:45
Ah OK.
orzo 2017-01-29 15:27:37
there is a type called Binding that :-> can produce, but when i defined it, i used "type Binding =" seperate than the "pattern (:->) :: k -> p -> Binding k p" line
monochrom 2017-01-29 15:28:33
They may want you to write Binding((:->))
ertes 2017-01-29 15:28:48
dfeuer: what's the proper way to add a finaliser to an STRef? ideally one that runs in ST within the same thread, but not necessarily
monochrom 2017-01-29 15:28:49
I am not 100% certain, but worth a try
ertes 2017-01-29 15:29:00
(same state thread that is)
ertes 2017-01-29 15:29:23
dfeuer: i tried adding it to the underlying MutVar#, but GHC doesn't like that
orzo 2017-01-29 15:29:29
does not export 'Binding(type (:->))
ertes 2017-01-29 15:29:41
dfeuer: and i'm not sure whether adding it to the STRef itself is safe
orzo 2017-01-29 15:30:31
oh wait sorry
orzo 2017-01-29 15:30:35
i think I failed to enable PatternSynonyms
dfeuer 2017-01-29 15:30:47
ertes: what do you mean by a finalizer?
ertes 2017-01-29 15:30:56
dfeuer: as in Weak
orzo 2017-01-29 15:30:59
my original syntax is fine
monochrom 2017-01-29 15:31:23
OK nice.
dfeuer 2017-01-29 15:31:34
ertes: GHC weak references smell kind of flaky. Why do you need that?
dfeuer 2017-01-29 15:32:53
ertes: it probably *should* be safe to add it to the underlying MutVar# using unsafeCoerce#, but that's only based on my memory of what edwardk told me about MutVar#. I dunno if we want something so weird in the test suite.
ertes 2017-01-29 15:33:24
dfeuer: yeah, i think i'm overengineering this at this point
ertes 2017-01-29 15:33:53
dfeuer: when a behaviour ceases to exist, the events it's based on should no longer notify it
dfeuer 2017-01-29 15:34:24
ertes: small test case better :P
ertes 2017-01-29 15:34:32
yeah =)
dfeuer 2017-01-29 15:34:34
Just as long as it's just weird enough.
dfeuer 2017-01-29 15:34:42
And relies maximally on the laziness of lazy ST.
ertes 2017-01-29 15:41:40
dfeuer: do you want to have unsafeIOToST in there?
ertes 2017-01-29 15:41:49
(with a proper use case)
ertes 2017-01-29 15:42:19
(adds 20 LoC)
dfeuer 2017-01-29 15:43:24
ertes: yeah. If it works with the current implementation, I'd like to know if I break it.
dfeuer 2017-01-29 15:43:37
I can't swear I won't, but it'd be good to know.
dfeuer 2017-01-29 15:44:03
If you can make sub-tests that test these different things that'd be even better, so I can track down a problem if I run into one.