Search Haskell Channel Logs

Sunday, January 29, 2017

#haskell channel featuring fragamus, geekosaur, orzo, glguy, byorgey, Koterpillar, and 6 others.

orzo 2017-01-29 13:55:10
What do you guys use for the parameter name when you invoke 'fix' on a lambda in order to make a loop?
orzo 2017-01-29 13:55:31
i used to use 'loop' but warnings of shaddowing a loop in Control.Arrow caused me to start using 'again'
Axman6 2017-01-29 13:55:49
f?
orzo 2017-01-29 13:55:58
hm
Koterpillar 2017-01-29 13:55:59
go?
monochrom 2017-01-29 13:56:13
self, go, rec,f, r
Axman6 2017-01-29 13:56:23
> fix (\f n -> if n < 1 then 1 else f (n-1) + f (n-2)) 7
lambdabot 2017-01-29 13:56:26
34
orzo 2017-01-29 13:57:20
when i want more arguments, i use 'flip fix' so i can hang the lambda off the end
orzo 2017-01-29 13:57:24
heh
orzo 2017-01-29 13:57:32
gets akward if i want yet another argument
glguy 2017-01-29 13:57:50
I'd use loop and remove the arrow import!
orzo 2017-01-29 13:58:13
i mainly inmport arrow for things like 'second'
monochrom 2017-01-29 13:58:16
Don't do that. Use recurse instead.
orzo 2017-01-29 13:58:42
recurse didn't show up in my hoogle search
monochrom 2017-01-29 13:58:56
I mean for your own names.
orzo 2017-01-29 13:59:44
you mean use a let instead of a lambda?
monochrom 2017-01-29 14:00:07
fix (\recursive_placeholder n -> if n < 1 then 1 else recursive_placeholder (n-1) + recursive_placeholder (n-2))
orzo 2017-01-29 14:00:54
i don't see how you solved the flip fix problem
orzo 2017-01-29 14:01:01
you still have to pass an initial value for n
monochrom 2017-01-29 14:01:22
You know what? I was talking to glguy.
orzo 2017-01-29 14:01:29
oh
glguy 2017-01-29 14:02:13
monochrom: Oh, yeah. recursion > using fix, but I like using the name loop for my recursively defined things
Tuplanolla 2017-01-29 14:02:21
I was going to suggest `again`, but QuickCheck has that.
orzo 2017-01-29 14:02:45
conflicting with QuickCheck is less of an issue for me though
orzo 2017-01-29 14:12:37
do you import 'fix' from Data.Function or Control.Monad.Fix ?
monochrom 2017-01-29 14:12:47
Data.Function.
monochrom 2017-01-29 14:12:58
Is there fix in Control.Monad.Fix?
byorgey 2017-01-29 14:13:12
yes, for hysterical raisins.
davean 2017-01-29 14:13:56
The one in Control.Monad.Fix is the only one I sue
davean 2017-01-29 14:14:02
er
monochrom 2017-01-29 14:14:02
If you're also using mfix, I guess you may like to just import Control.Monad.Fix and be done with it.
davean 2017-01-29 14:14:07
thats mfix, ignore me
orzo 2017-01-29 14:14:13
i never use mfix tho
davean 2017-01-29 14:14:20
mfix is amazingly useful
byorgey 2017-01-29 14:14:49
orzo: why do you use fix?
orzo 2017-01-29 14:15:11
for loops
pikajude 2017-01-29 14:15:19
for for loops?
orzo 2017-01-29 14:15:37
no heh
orzo 2017-01-29 14:15:49
i use 'fix' for making a loop
orzo 2017-01-29 14:16:03
often in IO monad
orzo 2017-01-29 14:16:11
is that a bad idea?
monochrom 2017-01-29 14:16:33
It's OK. "let" in a do-block gets old pretty quickly.
orzo 2017-01-29 14:17:16
what's your typical use of mfix?
monochrom 2017-01-29 14:17:42
To build a cyclic data structure (but its content comes from effects)
monochrom 2017-01-29 14:18:29
I rarely need it but that's what I would use when I needed one. And in a mathematical sense, that's its only use.
monochrom 2017-01-29 14:19:57
Because mfix carries out the effect only once. So, not the control-flow kind of recursion or loop. The only recursion/loop/self-reference left is on values and/or data and/or data dependency.
monochrom 2017-01-29 14:20:31
https://wiki.haskell.org/MonadFix
fragamus 2017-01-29 14:21:04
hey is any Haskell library decent for postgreSQL
fragamus 2017-01-29 14:24:19
I'm thinking this one http://hackage.haskell.org/package/HDBC-postgresql
monochrom 2017-01-29 14:30:01
http://www.mail-archive.com/haskell-cafe@haskell.org/msg92742.html
byorgey 2017-01-29 14:31:39
=D
orzo 2017-01-29 14:36:59
the mu and la references when over me
monochrom 2017-01-29 14:37:59
la is a poor one. Couldn't think up anything for it.
monochrom 2017-01-29 14:38:12
mu is the Greek letter people use for fix.
geekosaur 2017-01-29 14:38:21
Mu is a recursive type representing fixpoints
geekosaur 2017-01-29 14:38:32
la is just copying the original :)
monochrom 2017-01-29 14:39:17
It might have been slightly better if I wrote "lol, a state to follow SO"
Axman6 2017-01-29 14:39:31
fragamus: postgresql-simple is good, persistens can be useful if you need its features. hasql is quite fast. I don't think anyone uses the HDCB stuff any more
geekosaur 2017-01-29 14:39:38
> succ '\SO'
Axman6 2017-01-29 14:39:39
uh, HDBC
lambdabot 2017-01-29 14:39:40
'\SI'