erisco 2017-02-02 12:45:48
sorry for some reason commutativity was popping into my head
erisco 2017-02-02 12:46:32
neither the ranges nor points vary by assocation
erisco 2017-02-02 12:46:44
what was the thought with ranges?
recursion-ninja 2017-02-02 12:47:02
M0000, glguy, ertes: I solved my segfault issue. The artiy of the C function was 4 but I incorrectly defined the type signature of the C function in Haskell with an arity of 5. Thanks for suggesting I check the type signatures again! If only this could have been a compile time error somehow...
ph88 2017-02-02 12:48:01
i have this command that runs a quickcheck test main = qcrp (get :: Parser AddingOperator) Nothing if i change the thing after Parser then i can test a get function from another type. I would like to give it a list of all types to test in a specific order, is that possible ?
erisco 2017-02-02 12:48:22
oh, the points are wrong, heh
erisco 2017-02-02 12:48:44
and changed by association... the heck is wrong with me
erisco 2017-02-02 12:49:52
so you either have a policy of keeping the min or the max
ertes 2017-02-02 12:50:03
recursion-ninja: hmm? passing extra arguments to C functions shouldn't be a problem
ertes 2017-02-02 12:50:11
the calling convention supports it
erisco 2017-02-02 12:50:19
say we keep maxes, then 2 <> (1 <> 3) is 2 <> 3 is 3 is monotonic (not!)
erisco 2017-02-02 12:50:42
(2 <> 1) <> 3 is NotMonotonic <> 3 is NotMonotonic
erisco 2017-02-02 12:51:23
if you keep maxes you have to be left-associated
erisco 2017-02-02 12:51:28
if you keep mins then right-associated
erisco 2017-02-02 12:51:38
assuming we're doing <
glguy 2017-02-02 12:51:51
dmwit: Now adapt yours so that it can handle the input (2 : repeat 1)
erisco 2017-02-02 12:51:54
by keeping the range we're agnostic
glguy 2017-02-02 12:52:07
dmwit: (Mine already doesn't, I had to modify it to)
erisco 2017-02-02 12:52:37
I don't know but I suspect there is no particular way to reason about this with fold or foldMap so only ranges can be correct here
erisco 2017-02-02 12:57:24
glguy, so you have to add some zero, yes?
erisco 2017-02-02 12:58:51
then this becomes a... what is it...
recursion-ninja 2017-02-02 13:00:44
ertes: Maybe a warning to suggest that you might have made an arity mistake. I think the caseof mistakes greatly out weighs the cases of intentional usage.
erisco 2017-02-02 13:02:12
whatever a monoid + zero is
erisco 2017-02-02 13:02:26
welcome to the algebra zoo
dmwit 2017-02-02 13:05:31
glguy: Hm. =)
glguy 2017-02-02 13:07:36
dmwit: It's a really simple fix, so don't change much!
erisco 2017-02-02 13:08:37
I changed a lot, darn it :P
glguy 2017-02-02 13:09:28
OK, you can add any one character you want
erisco 2017-02-02 13:09:42
is it ~
glguy 2017-02-02 13:09:59
and... as many spaces as you need for it to parse afterward :)
erisco 2017-02-02 13:11:50
I am actually confused right now as to what I have done wrong, hrm
dmwit 2017-02-02 13:11:50
> appEndo (foldMap (\x -> Endo (\ ~(isMonotonic, min) -> (maybe True (x<=) min && isMonotonic, Just x))) (2 : repeat 1)) (True, Nothing)
lambdabot 2017-02-02 13:11:50
(False,Just 2)
dmwit 2017-02-02 13:12:06
right =)
dmwit 2017-02-02 13:12:56
I also lifted the (&&) out because it is prettier that way. ;-)
erisco 2017-02-02 13:17:41
aren't you depending on the associativity though
dmwit 2017-02-02 13:17:50
:t \f -> appEndo . foldMap (\x -> Endo (\old -> f x old <> old))
erisco 2017-02-02 13:17:51
be it left or right
lambdabot 2017-02-02 13:17:52
(Monoid a, Foldable t) => (t1 -> a -> a) -> t t1 -> a -> a
erisco 2017-02-02 13:18:05
of course for it to terminate we're hoping it is right-associative
erisco 2017-02-02 13:18:12
but nonetheless an assumption
taktoa 2017-02-02 13:20:43
I just realized something pretty funny: I've been writing Haskell for nearly 6 years now and the syntax highlighting for Haskell on the HaskellWiki has been broken the entire time (`'a'` is incorrectly matched by `['].*[']` rather than `['](.|[\]['abenr...])[']` or something)
taktoa 2017-02-02 13:22:06
(the consequence is that identifiers containing `'` are highlighted like strings)
erisco 2017-02-02 13:23:28
I am not sure how your solution works dmwit, hm
erisco 2017-02-02 13:23:42
how does it reveal the min without forcing the entire list
erisco 2017-02-02 13:25:05
oh I see, it passes it forward
erisco 2017-02-02 13:25:30
that is the funky interaction of folds and functions that I have a hard time seeing
erisco 2017-02-02 13:25:56
usually you're thinking about accumulating something from the tail
erisco 2017-02-02 13:26:01
but this way it is just the opposite
dmwit 2017-02-02 13:29:21
erisco: Trick question, it doesn't reveal the min.
dmwit 2017-02-02 13:29:44
It reveals the head. The name `min` is a psychological trick.
erisco 2017-02-02 13:31:01
yet I am still confused... lets go through this for [2,1]
dmwit 2017-02-02 13:32:18
this becomes [\(i,m) -> (maybe True (2<=) m && i, Just 2), \(i,m) -> (maybe True (1<=) m && i, Just 1)] from the map
erisco 2017-02-02 13:32:26
[\(isMono, min) -> (maybe True (2<=) min && isMono, Just 2), ...
dmwit 2017-02-02 13:32:37
Okay, you type. =)
erisco 2017-02-02 13:33:17
so that is applied to (True, Nothing) and we get [maybe True (2<=) Nothing && True, Just 2), ... which is [(True, Just 2), ...
erisco 2017-02-02 13:33:21
good so far?
dmwit 2017-02-02 13:33:38
no no
dmwit 2017-02-02 13:33:48
first the fold, *then* the application
erisco 2017-02-02 13:34:26
yes I know it is stuck together with composition, I am just reducing the first part
dmwit 2017-02-02 13:34:33
(\(i,m) -> ...2...) . (\(i,m) -> ...1...) $ (True, Nothing)
erisco 2017-02-02 13:35:47
oh, the composition is in the other order?
dmwit 2017-02-02 13:36:16
Specifically: `(\(i,m) -> (maybe True (2<=) m && i, ...)) . (\(i,m) -> (..., Just 1)) $ ...`
erisco 2017-02-02 13:36:42
that doesn't seem possible
erisco 2017-02-02 13:37:00
if that were the order, how does this ever terminate for infinite lists?
dmwit 2017-02-02 13:37:24
Because you don't need to see the `...`s in the above expression to make progress...
erisco 2017-02-02 13:37:38
I am just talking about the composition
dmwit 2017-02-02 13:37:48
So am I, I think.
erisco 2017-02-02 13:38:06
if we have f . g $ x we have to know g to apply to x, yes?
dmwit 2017-02-02 13:38:09
In an infinite list, the last `...` will be an infinitely long chain of compositions. But it doesn't matter because you don't need to see it to make progress.
dmwit 2017-02-02 13:38:17
erisco: no =)
erisco 2017-02-02 13:38:35
oh right, just f, derp
erisco 2017-02-02 13:38:49
the f guards the g... no wonder I get so confused
dmwit 2017-02-02 13:38:51
> const 3 . undefined $ undefined
lambdabot 2017-02-02 13:38:53
3
erisco 2017-02-02 13:39:25
I'm just stupidly thinking composition is right-to-left
erisco 2017-02-02 13:39:40
which doesn't actually reflect the order of evaluation
erisco 2017-02-02 13:39:44
which is left-to-right :P
ph88 2017-02-02 13:41:15
is that normal to get 54MB binaries from 4K LOC ?
dmwit 2017-02-02 13:41:46
I bet I can hit that with fewer than 4K. =)
ph88 2017-02-02 13:42:34
no dead code elimination ?
dmwit 2017-02-02 13:42:59
I'm not sure. But even if it's done, the default is for everything to be statically linked.
dmwit 2017-02-02 13:43:07
So big libraries -> big executables.
mniip 2017-02-02 13:45:02
dmwit, acme-everything it's called