frontendloader 2017-03-09 11:49:45
kuribas: "The compiler is your debugger" - #haskell
kuribas 2017-03-09 11:49:55
it sucks
ezyang 2017-03-09 11:50:32
invest in your logging infra
kuribas 2017-03-09 11:51:57
I have a long list of data representing bezier curves, it's giving me a headache...
monochrom 2017-03-09 11:52:03
frontendloader, I have seen in the past few days that kuribas's debugging need exceeds what type-checking can do.
frontendloader 2017-03-09 11:52:03
I agree with him, being able to step through/inspect code is how I learn/progress primarily
benzrf 2017-03-09 11:52:06
i debug using the repl
kuribas 2017-03-09 11:52:07
monochrom: yeah, it's numerical code.
kuribas 2017-03-09 11:53:01
monochrom: on the other hand I am abusing Data.Set, so it may be my fault...
monochrom 2017-03-09 11:53:32
I can't imagine how Data.Set could possibly be abused...
kuribas 2017-03-09 11:53:53
monochrom: I have an ordering of curves, which implies they don't touch.
kuribas 2017-03-09 11:54:13
monochrom: so I am using Data.Set as a binary tree
kuribas 2017-03-09 11:55:15
maybe debugging numerical code is just hard in general...
monochrom 2017-03-09 11:55:54
Ah, maybe you don't really have a total order. Yeah that could be abuse, but still not always.
kuribas 2017-03-09 11:56:14
monochrom: it's total as long as the invariant holds.
monochrom 2017-03-09 11:57:01
Hmm. Debug the invariant? :)
kuribas 2017-03-09 11:57:35
yeah, I have many assertions now
`Guest03 2017-03-09 11:58:49
how to poke an array efficiently?
`Guest03 2017-03-09 11:59:02
array comes from a list
`Guest03 2017-03-09 11:59:07
so, poke a list
`Guest03 2017-03-09 11:59:20
into adjacent locations as array
monochrom 2017-03-09 11:59:32
There is no efficient way for lists. Use a real array.
`Guest03 2017-03-09 11:59:51
oh, a question i wanted to ask
`Guest03 2017-03-09 12:00:38
if i write: arr = ByteString.pack [0, 1, 2, 3, 4]
monochrom 2017-03-09 12:01:49
Most array libraries have a "fromList" function or such for dumping a list into an array.
`Guest03 2017-03-09 12:01:54
as top-level definition
`Guest03 2017-03-09 12:03:30
what will it do at compile time and runtime?
monochrom 2017-03-09 12:05:01
Compile time will preserve that expression. Run time will do the conversion at most once, then memoize.
`Guest03 2017-03-09 12:05:01
monochrom: can i get it to convert it at compile time without TemplateHaskell?
monochrom 2017-03-09 12:05:01
No.
`Guest03 2017-03-09 12:05:01
i want that
monochrom 2017-03-09 12:05:01
Yes. Write a GHC plugin.
kuribas 2017-03-09 12:05:01
doesn't ghc unroll short expressions?
monochrom 2017-03-09 12:05:01
5 hours of template haskell can be saved by 5 months of GHC plugin.
monochrom 2017-03-09 12:05:01
FSVO "short"
monochrom 2017-03-09 12:05:01
Pretty sure "x :: Int; x = 1+1" is compile-time simplified.
`Guest03 2017-03-09 12:05:01
can we have it in future
AWizzArd 2017-03-09 12:05:01
System.Random.MWC – is it possible to use this to select a random item out of a list?
glguy 2017-03-09 12:05:13
and when we don't the future is a blur to you?
maerwald 2017-03-09 12:05:22
exactly
`Guest03 2017-03-09 12:33:36
i'm pleasantly surprised with highlevelness of some binding libraries
michalrus 2017-03-09 12:33:43
Hey! Quick (silly?) question: I have a list of functions, say, [a -> Maybe b], but I would also want each of them to have access to its own state — each state being of different type, unknown/transparent to the call site using this list. What would be the best way to approach this?
glguy 2017-03-09 12:34:16
What's state?
`Guest03 2017-03-09 12:34:17
you could think it would have ugly low-level types which need conversion every time, but no
monochrom 2017-03-09 12:34:26
There is no "state".
`Guest03 2017-03-09 12:34:52
not all types are high-level, but most are
jle` 2017-03-09 12:34:59
michalrus: well, each function can have its own closure
`Guest03 2017-03-09 12:35:18
shaderSource :: Shader -> StateVar [String] -- how cool, native strings.
jle` 2017-03-09 12:35:19
but by state, do you mean some sort of environment?
michalrus 2017-03-09 12:35:43
Yes, yes, I'm aware of that. :) Let's say the signature is [s -> a -> (s, Maybe b)], and state is s.
jle` 2017-03-09 12:35:50
for addN n = (\x -> x + n), n is a part of the colsure/'state' of 'addN 10'
michalrus 2017-03-09 12:35:53
How can I have different s for each function?
jle` 2017-03-09 12:36:48
michalrus: what are you planning on doing with this list?
michalrus 2017-03-09 12:43:27
Haha, OK. I'll explain it more widely.
jle` 2017-03-09 12:44:28
there's something you might be able to do with the 'auto' library that might let you do exactly what you described, but i'm not sure if you really want what you're asking for
jle` 2017-03-09 12:45:56
but the `Auto' a b` type represents an `(s -> a -> (b, s))` function paired with an initial state 's'