Search Haskell Channel Logs

Wednesday, February 1, 2017

#haskell channel featuring int-e, kmelva, merijn, systadmin, Arguggi, reactormonk, and 9 others.

Axman6 2017-02-01 01:45:43
there're warnings for when you don't use anything from Monad right?
Axman6 2017-02-01 01:46:18
anyway, those breakages lead to better code, so they're worthwhile (though painful for backwards compatibility I guess)
quchen 2017-02-01 01:46:22
Axman6: You mean »foo :: Monad m => m (); foo = pure ()«? No, that's warning-free
Axman6 2017-02-01 01:46:54
hmm, I thought it did for some reason. maybe it's hlint that does it
quchen 2017-02-01 01:47:36
We don't have a warning for »inferred type is more general than specified type« right now
Axman6 2017-02-01 01:52:03
maybe I dreamt it then =)
quchen 2017-02-01 01:54:29
Axman6: Dream it into GHC! Would be awesome to have a pragma »{-# MostGeneral foo #-}«
Axman6 2017-02-01 01:54:44
heh, agreed
Axman6 2017-02-01 01:55:07
isn't that basically the pragma which comments out the type sig you've written, and then complains when they differ? =)
merijn 2017-02-01 01:55:21
A warning for inferred type is more general would be annoying as hell
Axman6 2017-02-01 01:55:24
(up to alpha equality)
quchen 2017-02-01 01:55:35
merijn: Hence a pragma like INLINE
quchen 2017-02-01 01:55:44
Axman6: Pretty much, yes
Axman6 2017-02-01 01:56:04
not sure it's that useful if you need to do it for every function. per module would make sense, per project would be a pain
kmelva 2017-02-01 01:56:09
Can anyone lend a hand with: http://stackoverflow.com/questions/41980356/haskell-type-class-instance-with-more-restrictive-signature
kmelva 2017-02-01 01:56:24
I'd prefer hints, not straight up code, I'd like to work it out myself :)
reactormonk 2017-02-01 01:57:33
https://github.com/cjdev/test-fixture looks interesting... they're basically doing free for testing via typeclasses?
merijn 2017-02-01 01:57:53
kmelva: afaict that should work?
merijn 2017-02-01 01:58:01
kmelva: What exactly is the problem?
roxxik 2017-02-01 01:58:03
kmelva: looks like it needs more typeclass magic
kmelva 2017-02-01 01:58:25
merijn: it compiles, and works... but I want to forbid mixing X and Y axis...
merijn 2017-02-01 01:58:41
kmelva: Oh! I see the problem
kmelva 2017-02-01 01:58:42
roxxik: more magic.. in what way? :) some extension?
roxxik 2017-02-01 01:58:55
kmelva: like putting the x parameter in the class, using multiparametertypeclasses
merijn 2017-02-01 01:59:06
naah
merijn 2017-02-01 01:59:13
I don't think that's necessary, lemme try
roxxik 2017-02-01 01:59:17
i don't know... is just a best guess
roxxik 2017-02-01 02:00:06
you need to have access to x in the instance (x ~ y) => (Coordinate y) and then you're done
kmelva 2017-02-01 02:00:10
roxxik: I did try that, something like `class Slide (Coordinate x) b where ... slide :: Coordinate x -> b -> Coordinate x, but it doesn't comi;le
roxxik 2017-02-01 02:00:22
better: instance (x ~ y) => Slide (Coordinate y)
roxxik 2017-02-01 02:00:34
what's the error?
kmelva 2017-02-01 02:01:33
let me try again...
merijn 2017-02-01 02:01:49
roxxik: The problem is that 'a' is not being fixed by Coordindate in the first argument
Logio 2017-02-01 02:02:16
kmelva: why do you want to abstract slide into the type class in the first place?
Axman6 2017-02-01 02:02:56
could Slide x y not work, with instances for (x ~ y) => Slide x (Coordinate y) and Slide x Int64?
roxxik 2017-02-01 02:02:58
Logio: i think he wants to have a function doing the similar thing on different data types
Axman6 2017-02-01 02:03:11
(with multi param type classes)
roxxik 2017-02-01 02:03:20
Axman6: just what i tried to say
Axman6 2017-02-01 02:03:46
uh yes =)
Logio 2017-02-01 02:03:49
Wouldn't a better solution be to implement some typeclass Slidable, with a function that lifts a type into a coordinate?
roxxik 2017-02-01 02:03:49
and instead of multiparam typeclasses, i'd use associated types now
roxxik 2017-02-01 02:04:05
Logio: but which coordinate
merijn 2017-02-01 02:04:39
Logio: A better solution would be no typeclass :p
Logio 2017-02-01 02:05:06
yeah, that I'm wondering
roxxik 2017-02-01 02:05:16
hum... but how?
roxxik 2017-02-01 02:05:54
can't we let inference do the trick?
kmelva 2017-02-01 02:06:16
Axman6: where would you put (x ~ y) constriant? in the instance signatures?
Axman6 2017-02-01 02:06:47
kmelva: yeah
magthe 2017-02-01 02:07:00
What's the easiest way to implement Arbitrary for a type? `Data.DeriveTH`?
buglebudabey 2017-02-01 02:07:26
what does (x ~ y) mean?
roxxik 2017-02-01 02:07:35
x has the same type as y
buglebudabey 2017-02-01 02:07:40
ok cool
buglebudabey 2017-02-01 02:07:41
thanks
int-e 2017-02-01 02:07:46
s/has/is/
roxxik 2017-02-01 02:08:09
int-e: oh those are types :S yes
Axman6 2017-02-01 02:08:16
it's kind of a trick, instead of using Slide x (Coordinate x) which has several problems
roxxik 2017-02-01 02:08:30
that's a problem of instance selection
buglebudabey 2017-02-01 02:08:42
Axman6 what kind of problems would arise?
Axman6 2017-02-01 02:08:43
which others in here are far better qualifed to elaborate on
buglebudabey 2017-02-01 02:08:52
ah
Axman6 2017-02-01 02:09:11
http://blog.infinitenegativeutility.com/2017/1/haskell-type-equality-constraints
Axman6 2017-02-01 02:09:19
(this was posted last week)
roxxik 2017-02-01 02:09:41
Axman6: I was just searching that post right now
merijn 2017-02-01 02:10:15
Does Conduit have something like pipes' stateP, that is "ConduitM () Void (StateT s m) a -> s -> ConduitM () Void m a", that is a way to run some other transformer internall in the conduit?
buglebudabey 2017-02-01 02:10:24
that link isn't loading, is it just me?
merijn 2017-02-01 02:10:32
Or is this basically just me wanting mmorph?
buglebudabey 2017-02-01 02:11:07
now it works it was jsut me
merijn 2017-02-01 02:11:07
Except ConduitM isn't an instance of MFunctor :\
jophish 2017-02-01 02:11:15
hexagoxel: what's the status of iridium at the moment?
Axman6 2017-02-01 02:11:55
janos: still super dense, and the satellites are still flying
Axman6 2017-02-01 02:12:04
uh, jophish
merijn 2017-02-01 02:12:05
oh, wait, ConduitM is an MFunctor :D
jophish 2017-02-01 02:13:06
Axman6: hehe, I meant the iridium package :)
Axman6 2017-02-01 02:13:29
jophish: also makes great spark plugs :P
jophish 2017-02-01 02:14:08
:)
Axman6 2017-02-01 02:14:28
ok, I had no idea iridium existed and I feel my life was worse off for that
Axman6 2017-02-01 02:14:52
that looks amazingly useful, we need more tooling like that in Haskell
jophish 2017-02-01 02:17:33
Axman6: yeah I use it all the time. Could do with a little love though
janos 2017-02-01 02:18:34
Axman6: What does that mean?
Axman6 2017-02-01 02:18:52
janos: it was a mis-tab-completion for jophish
janos 2017-02-01 02:19:07
Axman6: ah ok, fair enough :0
janos 2017-02-01 02:19:08
:)
merijn 2017-02-01 02:34:15
There's no way to query the number of forked threads, right?
systadmin 2017-02-01 02:35:17
sobored
Arguggi 2017-02-01 02:37:55
I can't seem to build distributive-0.5.2 with new-build (stable or HEAD), can anyone confirm?
merijn 2017-02-01 02:42:03
Is there a good way to rate-limit the amount of forkIO/Async's I spawn? I'd use a Chan with a fixed number of threads, but it's hard to signal termination that way...
MarcelineVQ 2017-02-01 02:42:04
merijn: it seems like it should be possible, the rts needs to manage memory and schedule them so it must have some idea
systadmin 2017-02-01 02:44:07
Is there a way to repeat a given string for exactly n times?
systadmin 2017-02-01 02:44:22
Oh wait, nevermind
merijn 2017-02-01 02:44:36
i.e., if I have 10 million tasks I would like to avoid spawning 10 million threads, since there's no point in that :p