Search Haskell Channel Logs

Wednesday, February 1, 2017

#haskell channel featuring c_wraith, lambdabot, Tuplanolla, dfeuer, ski, ph88,

lpsmith 2017-02-01 07:56:48
samvher, There's actually a test for ensuring that postgresql-simple doesn't do something too wrong with unicode: https://github.com/lpsmith/postgresql-simple/blob/master/test/Main.hs#L282
lpsmith 2017-02-01 07:56:57
Of course, the test could probably be better.
lpsmith 2017-02-01 07:57:08
:)
ph88 2017-02-01 07:58:29
this looks very doable :) https://generics-eot.readthedocs.io/en/latest/tutorial.html
Tuplanolla 2017-02-01 08:09:44
If I want to define `link3 a b c` for `Async` computations, should I simply `link2 a b >> link2 b c`?
tabaqui1 2017-02-01 08:12:03
looks like IntSet is not maintained
tabaqui1 2017-02-01 08:12:12
there are many instances missing
Cale 2017-02-01 08:12:18
tabaqui: which instances?
tabaqui1 2017-02-01 08:12:24
foldable, f.e.
tabaqui1 2017-02-01 08:12:49
ah, ok
tabaqui1 2017-02-01 08:13:02
ehm, yes
tabaqui1 2017-02-01 08:13:13
IntMap actually has foldable, but...
Cale 2017-02-01 08:13:18
That's... no, it can't
tabaqui1 2017-02-01 08:13:32
by default it can be folded just by values, not by keys
Cale 2017-02-01 08:13:35
IntSet can't, because it's not even a functor
Cale 2017-02-01 08:13:46
Well, that's not exactly required
Cale 2017-02-01 08:14:01
But it's not parametric, so it's the wrong kind of type to be an instance of Foldable
Cale 2017-02-01 08:14:21
IntMap can be, because it has a type parameter
ski 2017-02-01 08:14:30
@kind Foldable
lambdabot 2017-02-01 08:14:32
(* -> *) -> Constraint
ski 2017-02-01 08:14:32
@kind IS.IntSet
tabaqui1 2017-02-01 08:14:33
yeah, you're right
lambdabot 2017-02-01 08:14:34
*
tabaqui1 2017-02-01 08:14:44
I gonna go home, today)
Cale 2017-02-01 08:15:03
Everything in the containers package is maintained -- ask dfeuer :D
dfeuer 2017-02-01 08:15:27
Hi.
tabaqui1 2017-02-01 08:15:31
dfeuer = fox@ucw.cz?
dfeuer 2017-02-01 08:15:31
Bah.
dfeuer 2017-02-01 08:15:36
tabaqui1: no.
Cale 2017-02-01 08:16:13
dfeuer: Don't worry, there's no new work here ;)
dfeuer 2017-02-01 08:16:17
tabaqui1: fox@ucw.cz probably is Milan Straka.
dfeuer 2017-02-01 08:16:36
tabaqui1: I'm mostly dfeuer, but on GitHub I'm treeowl.
tabaqui1 2017-02-01 08:17:22
uhm, hi
dfeuer 2017-02-01 08:17:28
And no, IntSet can't be a Foldable. It can be an MFoldable.
tabaqui1 2017-02-01 08:17:43
yes, I forgot about type parameter
tabaqui1 2017-02-01 08:17:51
another one:
dfeuer 2017-02-01 08:17:57
Also, Wren Romano is primarily in charge of IntSet and IntMap.
tabaqui1 2017-02-01 08:18:09
binary package describes derivations for most of "containers"
tabaqui1 2017-02-01 08:18:18
but not for "unordered-containers"
dfeuer 2017-02-01 08:18:18
Because she can handle all the terrifying bit hacks and such.
dfeuer 2017-02-01 08:18:34
unordered-containers is an unrelated package, maintained by tibbe.
tabaqui1 2017-02-01 08:20:45
I think it's about "binary" not about "u-containers"
tabaqui1 2017-02-01 08:21:46
Is it true, that class methods "toList" and "fromList" come to haskell recently
Cale 2017-02-01 08:22:03
Well, depends on what you mean by "recently"
tabaqui1 2017-02-01 08:22:04
because it seems logical to me that
Cale 2017-02-01 08:22:09
It was like a decade ago
tabaqui1 2017-02-01 08:22:32
instance (Foldable a) => Binary a where { get = fromList <$> get }
tabaqui1 2017-02-01 08:22:35
by default
Cale 2017-02-01 08:22:44
You can't actually write that instance though.
Cale 2017-02-01 08:22:55
Because it would overlap with every other instance
Cale 2017-02-01 08:23:40
Also, note that when deciding which instance to select, the algorithm *must* ignore the class constraints on the instances.
Cale 2017-02-01 08:24:07
This is because you can never rely on an instance of some class not being available -- it could always be provided by some future module which hasn't been compiled, or even written yet.
Cale 2017-02-01 08:24:44
So if you start making decisions regarding which instance is selected based on the absence of other instances, when that assumption changes, all the code you compiled is now wrong.
Cale 2017-02-01 08:25:16
(and you end up with confusing and/or incoherent behaviour depending on how the program gets linked together)
Cale 2017-02-01 08:25:48
So that instance looks to the algorithm like instance Binary a where ...
Cale 2017-02-01 08:26:01
i.e. it'll always match
Cale 2017-02-01 08:26:26
(and only after committing to that instance will a Foldable instance be required)
tabaqui1 2017-02-01 08:27:11
hmm, but "toList hashtable" can get different results for now and after some time
tabaqui1 2017-02-01 08:27:52
I think that there are instances for containers, because they are *ordered*
tabaqui1 2017-02-01 08:28:03
and toList always return the same list for 'em
tabaqui1 2017-02-01 08:28:28
unlike of hashtables
tabaqui1 2017-02-01 08:28:54
but there is still toList :: HashTable a -> List a
ski 2017-02-01 08:29:55
(`instance Foldable a => Binary a where get = fromList <$> get' also doesn't kind-check)
tabaqui1 2017-02-01 08:30:21
ski: yes, forget about type parameter again
tabaqui1 2017-02-01 08:30:38
but you catch the idea?
ski 2017-02-01 08:31:09
not really
tabaqui1 2017-02-01 08:31:36
any foldable type has toList method
Cale 2017-02-01 08:31:52
You probably meant instance (Foldable f, Binary a) => Binary (f a)
tabaqui1 2017-02-01 08:31:56
any list with binary content can be serialized
monochrom 2017-02-01 08:31:57
@type toList
Cale 2017-02-01 08:31:58
however, even that's a bad idea
lambdabot 2017-02-01 08:31:59
error:
lambdabot 2017-02-01 08:31:59
Ambiguous occurrence 'toList'
lambdabot 2017-02-01 08:31:59
It could refer to either 'F.toList',
tabaqui1 2017-02-01 08:32:05
so and foldable can be serialized too
monochrom 2017-02-01 08:32:12
@type F.toList
lambdabot 2017-02-01 08:32:14
Foldable t => t a -> [a]
ski 2017-02-01 08:32:25
perhaps you meant something like `instance (Foldable f,..a..) => Binary (f a) where ...', but it's not clear to me which constraints `..a..' involving `a' you intended
ski 2017-02-01 08:32:49
(hm, i suppose what Cale said)
Cale 2017-02-01 08:33:36
You also probably want more than just Foldable
Cale 2017-02-01 08:33:48
Since you'll have no problem encoding, but decoding will be an issue
Cale 2017-02-01 08:34:10
Given only Foldable, there's no way to put the structure back together from a list.
monochrom 2017-02-01 08:34:24
(Traversable f, Monad f, Comonad f, Covariant f, Contravariant f) =>
tabaqui1 2017-02-01 08:34:29
ah
tabaqui1 2017-02-01 08:34:36
foldable has no fromList
tabaqui1 2017-02-01 08:34:49
blind me
tabaqui1 2017-02-01 08:35:12
okay, thanks, I'll better go home)
c_wraith 2017-02-01 08:42:03
monochrom, what's that now? monad + contravariant implies the type parameter is phantom, which contradicts comonad... :)
monochrom 2017-02-01 08:43:22
Yes! I was trying to make it vacuous :)
monochrom 2017-02-01 08:44:57
<- Always fond of the joke about a math PhD thesis that adds so many axioms you can prove many nice theorems, but the only thing satisfying all axioms is the () monoid or something.