Search Haskell Channel Logs

Tuesday, January 31, 2017

#haskell channel featuring janos, barrucadu, dmj`, c_wraith, hpc, Jello_Raptor, and 7 others.

c_wraith 2017-01-31 11:49:42
mbrock, you can always use quickcheck to create models that it's more suited for, them convert those models to actual data structures in the properties it's testing.
janos 2017-01-31 11:53:36
Hi, has somebody expierence with the Spock Library?
janos 2017-01-31 11:54:29
runDb :: (HasSpock m , SpockConn m ~ ConnectionPool) =>
janos 2017-01-31 11:54:29
Action IO a -> m a
janos 2017-01-31 11:54:31
or does somebody know what a ~ in the function definition means? E.g.:
mbrock 2017-01-31 12:03:26
c_wraith: yeah, I'm starting to make scenario data types with more specialized arbitrary generators, but the way you formulate it gives me some more hints, thanks
Koterpillar 2017-01-31 12:06:17
janos: it means the types on both sides of ~ are the same
Koterpillar 2017-01-31 12:06:56
janos: so this constraint reads as: m must be an instance of HasSpock, and its associated SpockConn type must be ConnectionPool
HallaSurvivor 2017-01-31 12:06:57
Hey! What are some of the arguments for laziness? All I can really find online is infinite data structures, but I don't know how useful those are in practice
Koterpillar 2017-01-31 12:07:09
HallaSurvivor: you don't want to compute what you won't use
HallaSurvivor 2017-01-31 12:07:57
Koterpillar: so you get an efficiency boost in some cases. Are there others?
HallaSurvivor 2017-01-31 12:08:23
Koterpillar: especially since it makes parallelism more verbose/impossible
Koterpillar 2017-01-31 12:09:04
how does it make it impossible?
mbrock 2017-01-31 12:11:50
it's been said that laziness kept Haskell necessarily pure, and by that story, it's one of the things that made Haskell different and interesting, leading to a lot of innovation
lambdafan 2017-01-31 12:11:50
somone better go tell Simon right away!
janos 2017-01-31 12:12:35
Koterpillar: Thank you!
janos 2017-01-31 12:13:40
Koterpillar: you don't know by chance how to use Spock Library?
Koterpillar 2017-01-31 12:14:04
janos: are you expecting me to summarize the answer in one sentence?
kadoban 2017-01-31 12:14:13
HallaSurvivor: Just to be clear, it doesn't make parallelism impossible, far from it. Parallelism is actually quite nice in haskell.
barrucadu 2017-01-31 12:14:30
Koterpillar: Parallelism is incredibly simple in Haskell, but that's because of purity, not laziness
lambdafan 2017-01-31 12:14:52
janos: what party of the Spock tutorial are you having trouble with?
lambdafan 2017-01-31 12:14:56
erm part
barrucadu 2017-01-31 12:15:11
Whoops, HallaSurvivor, not Koterpillar
janos 2017-01-31 12:15:15
Koterpillar: I don't understand
barrucadu 2017-01-31 12:15:35
No, I was right the first time. Ugh, it's too late
Koterpillar 2017-01-31 12:15:59
janos: what is it that you don't understand?
janos 2017-01-31 12:16:04
lambdafan: actually the Spock tutorial is very short. I am trying to use MongoDB with Spock, but I think my Haskell knowledge is too limited
lambdafan 2017-01-31 12:17:34
janos: my first thought is maybe you want to use something like Yesod which handles alot of things for you. I'm thinking in exchange for a little heavyweghtness, you can get going with mongodb faster.
janos 2017-01-31 12:17:36
Koterpillar: Actually how to create a connection/connectionpool for MongoDB in Spock
janos 2017-01-31 12:17:59
lambdafan: mhmm..
Koterpillar 2017-01-31 12:18:22
janos: OK, sorry, no idea about that. But maybe someone here knows the answer, now that you've formulated the question.
lambdafan 2017-01-31 12:18:43
the thing about Spock and Scotty is it leaves alot of details to you, details that you maybe at this point in your learning curve, would be better off leaving until later. Yesod handles much of that. But, it is a bit heavy, and opinionated.
janos 2017-01-31 12:18:46
Koterpillar: OK no problem
lambdafan 2017-01-31 12:19:41
I was able to get going with postgres on yesod doing nothing more than reading tutorials and making the types match. mongodb would be no different I expect.
janos 2017-01-31 12:19:58
lambdafan: yeah, I see what you mean. Actually I don't even need pooling, just doing simple requests would be enough :)
janos 2017-01-31 12:21:29
lambdafan: OK I see.
dmj` 2017-01-31 12:25:09
janos: do you feel comfortable with monad transformers and concurrency
janos 2017-01-31 12:25:30
concurrency yes, monad transformers meh :D
janos 2017-01-31 12:26:08
dmj`: concurrency yes, monad transformers meh :D
hpc 2017-01-31 12:31:50
janos: ever put a whole bunch of fmaps together in order to apply an operation really deeply in a data structure?
hpc 2017-01-31 12:32:40
transformers are an abstraction over something like that except for Monad
Jello_Raptor 2017-01-31 12:33:04
Is there an HList style Either somewhere? Where the element being held can be one of any type in the list?
janos 2017-01-31 12:34:26
hpc: I see, I am just reading a bit about transformers
hpc 2017-01-31 12:35:45
a good place to start as far as documentation is https://hackage.haskell.org/package/mtl-2.2.1/docs/Control-Monad-Reader.html#g:3
hpc 2017-01-31 12:36:26
(and pay attention to the MonadTrans class instance)
hpc 2017-01-31 12:36:54
and you'll eventually need to know about https://hackage.haskell.org/package/base-4.8.0.0/docs/Data-Functor-Identity.html
hpc 2017-01-31 12:37:09
which is usually what is used to mark the "end" of composing transformers
hpc 2017-01-31 12:37:35
other than that just read about them and mess with them in ghci
janos 2017-01-31 12:39:13
hpc: ok thanks for the reading.
dmj` 2017-01-31 12:43:34
@google transformers step by step
lambdabot 2017-01-31 12:43:35
https://page.mi.fu-berlin.de/scravy/realworldhaskell/materialien/monad-transformers-step-by-step.pdf
antalsz 2017-01-31 12:45:06
Does `Data.ByteString.Lazy.writeFile` do lazy IO? If so, is there a good way to force it?