Search Haskell Channel Logs

Sunday, January 29, 2017

#haskell channel featuring dfeuer, Athas, glguy, lpaste, kirillow, hpc, and 7 others.

ertes 2017-01-29 04:45:29
nobody here will disagree about the benefits of examples, but somebody has to do it
Ferdirand 2017-01-29 04:45:34
isn't printf evil anyway ?
ertes 2017-01-29 04:45:58
not really… it doesn't have the same problems that printf in C has
ertes 2017-01-29 04:46:18
but it is dynamically typed, so i'd say it's ugly, not necessarily evil
Ferdirand 2017-01-29 04:46:29
fair enough
lyxia 2017-01-29 04:48:55
Write a statically typed printf with a quasiquote for the format string.
ertes 2017-01-29 04:49:54
printf (Proxy :: Proxy "%d\n") 23
Ferdirand 2017-01-29 04:50:00
that actually sounds like a nice exercise
ertes 2017-01-29 04:51:33
for this kind of application it would be nice to have a singleton type family for strings with automatic type inference from literals
ertes 2017-01-29 04:51:43
"abc" :: "abc"
ertes 2017-01-29 04:51:47
like this
hpc 2017-01-29 04:53:30
really though, it's printf
hpc 2017-01-29 04:54:20
pretty much all it needs to say is "works the same as in C" and you instantly know what it does
ertes 2017-01-29 04:55:04
i guess we can no longer assume that people are familiar with C, which… is a good thing, i guess
hpc 2017-01-29 04:55:05
and as it turns out, the first sentence on the page is "A C printf(3)-like formatter."
hpc 2017-01-29 04:55:40
so i guess the examples you are looking for can be found at man 3 printf
ertes 2017-01-29 04:59:52
if we add padding and alignment stuff to ShowS and write better documentation for it, that might be a better option
lpaste 2017-01-29 05:01:34
kirillow pasted "WebSocket Warp Wai Problem" at http://lpaste.net/351767
kirillow 2017-01-29 05:01:43
Please help?
ph88 2017-01-29 05:02:37
why is stack package index so big ? it's like 200 mb o_O
ertes 2017-01-29 05:03:31
kirillow: sounds like something is timing out… wrap your forever-action in an exception handler to see if any are thrown
ertes 2017-01-29 05:04:27
kirillow: forever c `onException` \(SomeException ex) -> print ex >> throw ex
ertes 2017-01-29 05:04:37
whoops
ertes 2017-01-29 05:04:41
kirillow: forever c `catch` \(SomeException ex) -> print ex >> throw ex
ertes 2017-01-29 05:04:43
like that
kirillow 2017-01-29 05:05:15
o_O
kirillow 2017-01-29 05:05:20
thanks!
kirillow 2017-01-29 05:05:22
will try
dfeuer 2017-01-29 05:06:48
Anyone here have some interesting lazy ST code?
dfeuer 2017-01-29 05:07:06
I want to test a substantial overhaul of the lazy ST implementation.
dfeuer 2017-01-29 05:07:14
Make sure I didn't break everything.
ertes 2017-01-29 05:07:24
dfeuer: make a lazy list of random numbers using mwc-random
dfeuer 2017-01-29 05:08:21
ertes: it's hard to work with proper *packages* in this context; too much stuff doesn't work with 8.1....
dfeuer 2017-01-29 05:08:26
I can attempt it.
ertes 2017-01-29 05:08:33
i see
dfeuer 2017-01-29 05:08:39
Thanks for the idea.
dfeuer 2017-01-29 05:08:55
I will steal it anyway.
ertes 2017-01-29 05:08:56
dfeuer: well, write an RC4 implementation to produce the stream
ertes 2017-01-29 05:09:06
naive RC4 is like 10 lines of code
ertes 2017-01-29 05:09:18
it uses a mutable array
dfeuer 2017-01-29 05:09:28
Betterer and betterer!
dfeuer 2017-01-29 05:10:04
ertes: how about uses of mfix with lazy ST?
ertes 2017-01-29 05:10:36
hmm… i can't think of a proper example
dfeuer 2017-01-29 05:10:44
Yeah....
ertes 2017-01-29 05:11:03
you could shoehorn it in, i guess
ertes 2017-01-29 05:12:05
an STRef only starts existing when the action is actually run, right?
ertes 2017-01-29 05:12:31
ah, wait
ertes 2017-01-29 05:14:36
dfeuer: STRef is boxed, so you could probably force mfix in somehow to keep track of the two RC4 indices
Tuplanolla 2017-01-29 05:15:11
How about using a vector with the head reserved for indices?
ertes 2017-01-29 05:15:37
vector requires a package though
Tuplanolla 2017-01-29 05:15:44
Right...
ertes 2017-01-29 05:16:12
(the indices could just as easily be recursive arguments, but this is for testing)
dfeuer 2017-01-29 05:16:21
ertes: the trouble is really that I don't know all the ways these thing might interact, so coming up with small artificial test cases is better than nothing, but I'd *much* rather play with code that does lots of fancy shit already :/
ph88 2017-01-29 05:16:54
i noticed when i type stack ghci and it starts to build packages that it just launches 2 ghc processes, how can i launch 4 so that it uses all my cores ?
ertes 2017-01-29 05:17:01
dfeuer: i think, i can implement a very small Event-only FRP system that works exclusively in ST
dfeuer 2017-01-29 05:17:07
ertes: array doesn't require anything.
ertes 2017-01-29 05:17:13
dfeuer: then you can make heavy non-trivial use of mfix
dfeuer 2017-01-29 05:17:19
Lazy ST?
hpc 2017-01-29 05:17:35
ph88: the -j parameter
ertes 2017-01-29 05:17:38
you can use it in lazy ST in order to produce a stream
dfeuer 2017-01-29 05:17:49
I mostly want to make sure I haven't broken any laziness.
hpc 2017-01-29 05:17:50
(same as make and other stuff)
ertes 2017-01-29 05:18:09
yeah, that should be testable
dfeuer 2017-01-29 05:18:13
Wooooo.
Athas 2017-01-29 05:18:33
Hov does Haskell manage to avoid making 'as' a reserved word?
hpc 2017-01-29 05:18:46
Athas: it only occurs in import syntax
Tuplanolla 2017-01-29 05:18:50
Context-sensitive tokenization, Athas.
Athas 2017-01-29 05:18:57
Ugh.
ertes 2017-01-29 05:19:12
dfeuer: shall i?
kirillow 2017-01-29 05:19:30
"Thread killed by Warp's timeout reaper" well that sucks
Athas 2017-01-29 05:19:30
I actually thought you couldn't do that with Alex. I'll have to check that out.
dfeuer 2017-01-29 05:19:36
BTW, ertes, the differential is at https://phabricator.haskell.org/D3038. If you want to compile that with 8.0, you'll have to change the definition of runST to unsafeCoerce# runRW#.
dfeuer 2017-01-29 05:19:54
ertes: well, if you think you can do that *easily*, then yes, I'd very much appreciate it!
glguy 2017-01-29 05:20:15
Athas: It doesn't have to modify Alex to support that
glguy 2017-01-29 05:20:23
It would be handled in the parser
ertes 2017-01-29 05:20:27
dfeuer: i'll implement it and leave integration to you =)
dfeuer 2017-01-29 05:20:56
ertes: wheeeeee. Do you think you could maybe also review that differential? Make sure none of my changes look insane?
dfeuer 2017-01-29 05:21:40
(and maybe even see if you think it likely actually fixes the bug?)
glguy 2017-01-29 05:22:14
Athas: https://github.com/ghc/ghc/blob/master/compiler/parser/Parser.y#L3256-L3274
glguy 2017-01-29 05:23:03
Athas: The grammar simply has cases in the production for identifiers that allows certain keywords to be used as identifiers
Athas 2017-01-29 05:23:21
glguy: I see. I guess that's not too bad. It's not really context-sensitive lexing.
ertes 2017-01-29 05:23:34
dfeuer: i'm not competent enough to see errors there that go beyond type errors =/
ph88 2017-01-29 05:24:09
hpc, do you know how i can set -j4 globally for whenever i use stack ?
hpc 2017-01-29 05:24:38
i don't
dfeuer 2017-01-29 05:30:59
ertes: if you do that trick with FRP or whatever, please just lambdabot message me or email. I have to run now. Thanks again!
ertes 2017-01-29 05:35:29
dfeuer: if you're still there: is STRef enough, or do i need to use arrays, too?
ertes 2017-01-29 05:37:07
so much for that =)
g256 2017-01-29 05:40:30
hi
lambdabot 2017-01-29 05:42:20
Hello.
g256 2017-01-29 05:43:58
@help
lambdabot 2017-01-29 05:43:58
help . Ask for help for . Try 'list' for all commands
g256 2017-01-29 05:44:09
@list
lambdabot 2017-01-29 05:44:09
What module? Try @listmodules for some ideas.
g256 2017-01-29 05:44:23
@listmodules
lambdabot 2017-01-29 05:44:23
activity base bf check compose dice dict djinn dummy elite eval filter free fresh haddock help hoogle instances irc karma localtime metar more oeis offlineRC pl pointful poll pretty quote search
lambdabot 2017-01-29 05:44:23
slap source spell system tell ticker todo topic type undo unlambda unmtl version where
g256 2017-01-29 05:44:37
@activity
lambdabot 2017-01-29 05:44:38
4*total 4*#haskell