Search Haskell Channel Logs

Saturday, January 28, 2017

#haskell channel featuring aries_liuxueyang, lambdabot, fmapE, Tuplanolla, monochrom, Cale,

fmapE 2017-01-28 11:46:51
Anyone know how to temporarily disable or mask the RTS timer interrupt (SIGVTALRM) to a Haskell thread?
monochrom 2017-01-28 11:47:26
Something about -V0
fmapE 2017-01-28 11:47:29
I have a read() call which goes to a OneWire sensor (supported by the w1-therm Linux kernel module
fmapE 2017-01-28 11:47:53
monochrome yeah I did that but I want a way to just temporarily mask it around one call to hGetSome or hGetContents
monochrom 2017-01-28 11:48:09
err not -V0
fmapE 2017-01-28 11:48:24
monochrom: +RTS -V0 worked
fmapE 2017-01-28 11:48:40
monochrom: but I want to use the lib I'm writing in a webserver or something
monochrom 2017-01-28 11:48:43
OK good
fmapE 2017-01-28 11:48:55
monochrom: So I don't want the RTS ticks turned off
fmapE 2017-01-28 11:49:06
monochrom: just want to mask them around one IO call
monochrom 2017-01-28 11:49:37
Ah OK. I don't know.
fmapE 2017-01-28 11:49:38
monochrom: issue is the read() call takes a while because the kernel module starts querying the OneWire sensor when the read() is issued
fmapE 2017-01-28 11:49:54
And then the SIGVTALRM repeatedly interrupts the read forcing a do-over
fmapE 2017-01-28 11:50:05
monochrom: ok well thanks
monochrom 2017-01-28 11:55:04
Does it help if the read() call happens in a non-main thread?
fmapE 2017-01-28 11:55:46
monochrom: I'll try that. Does the RTS timer only interrupt the main thread?
monochrom 2017-01-28 11:56:03
I don't know.
fmapE 2017-01-28 12:00:14
monochrom: I'm building something that runs the hGetSome call inside a forkOS thread, we'll see if it works
fmapE 2017-01-28 12:00:56
monochrom: That seems to have done it :)
monochrom 2017-01-28 12:01:08
I think some people surrender and write a loop over a system call until the reason it finishes or dies is not E_INTR
monochrom 2017-01-28 12:01:20
OK good.
fmapE 2017-01-28 12:01:25
monochrom: Yeah that won't work in this case, already tried
monochrom 2017-01-28 12:01:31
Ah
fmapE 2017-01-28 12:01:39
monochrom: it starts fresh trying to query the OneWire sensor every time read() is issued
fmapE 2017-01-28 12:01:54
And every time that takes too long and gets interrupted by SIGVTALRM
monochrom 2017-01-28 12:01:57
Yikes.
fmapE 2017-01-28 12:02:37
If I use a non-blocking read it just always returns immediately because there's no data ready, because no data is there until read() gets issued and it starts polling the sensor
fmapE 2017-01-28 12:02:39
It's a mess
aries_liuxueyang 2017-01-28 12:16:01
Hello. When I build hugs98. It stucks at here: https://goo.gl/CIVJGq for a long time maybe above 15 minutes. No error message output. Does it failed?
aries_liuxueyang 2017-01-28 12:16:31
I downloaded the source code from here: https://www.haskell.org/hugs/pages/downloading.htm I use Slackware Linux.
aries_liuxueyang 2017-01-28 12:16:56
Does anyone knows why? Thanks in advance!
Tuplanolla 2017-01-28 12:17:28
Why Hugs, aries_liuxueyang?
aries_liuxueyang 2017-01-28 12:18:47
Tuplanolla: Because I am learning a course. It requires Hugs instead of GHCi.
Tuplanolla 2017-01-28 12:19:00
That's silly.
geekosaur 2017-01-28 12:19:55
presumably something has changed incompatibly in docbook2html
geekosaur 2017-01-28 12:20:20
you probably won't find much help with it; hugs is pretty long dead
Cale 2017-01-28 12:20:29
Hugs is no longer maintained, and it's been well over a decade since it was really reasonable to use it.
aries_liuxueyang 2017-01-28 12:20:39
Tuplanolla: In fact, I am not quite understand the reason. But there is a post: https://courses.edx.org/courses/course-v1:DelftX+FP101x+3T2015/discussion/forum/i4x-DelftX-FP101x-course-3T2014/threads/56200291d2aca5b29c0007c9
geekosaur 2017-01-28 12:21:02
sends me to a login screen
Cale 2017-01-28 12:21:21
aries_liuxueyang: I say try getting GHCi and using that instead.
aries_liuxueyang 2017-01-28 12:21:31
geekosaur: sorry. I didn't know this page requires login. :(
Cale 2017-01-28 12:21:51
There will be some small differences, but it shouldn't ruin the course.
aries_liuxueyang 2017-01-28 12:22:38
geekosaur: https://paste.kde.org/phjhwp4he Here is the reason he said.
monochrom 2017-01-28 12:23:20
You may have better luck finding a pre-built hugs instead of compiling your own.
Cale 2017-01-28 12:23:31
Yeah, that's a silly reason. He could instead have just distributed his own Prelude to use for the course.
geekosaur 2017-01-28 12:23:52
or just tell you to use ghc 7.8.x
monochrom 2017-01-28 12:24:05
Ubuntu has one, maybe Slackware has it too.
Cale 2017-01-28 12:24:16
Right, GHC 7.8 still is a far more reasonable thing to run than hugs
monochrom 2017-01-28 12:24:58
I don't completely believe in type-driven development to begin with.
aries_liuxueyang 2017-01-28 12:25:18
monochrom: I will have a try. Cale, geekosaur, I have installed GHCi 7.10.3 and I will use it first.
monochrom 2017-01-28 12:25:29
Haskell types have limitations, even with Haskell 2010.
aries_liuxueyang 2017-01-28 12:25:34
Thanks all of you. :P
geekosaur 2017-01-28 12:25:42
that one runs yo into the problem the message describes; AMP and FTP will likely confuse things
monochrom 2017-01-28 12:26:03
I have a cunning plan. Run virtualbox; inside that, install Ubuntu and then you can just apt-get install hugs98.
Cale 2017-01-28 12:26:23
Well, they'll confuse things *slightly*, but you can just take 5 minutes to understand what's going on there.
Tuplanolla 2017-01-28 12:26:24
It hasn't been a problem on our course. Students are pretty good at ignoring type constraints before they understand them.
aries_liuxueyang 2017-01-28 12:26:59
monochrom: yeah, that's a solution.
Cale 2017-01-28 12:27:15
Once you know that whenever you have a Traversable t constraint, it's possible to plug in [] for t, so that t a becomes [a], then everything should be fine.
monochrom 2017-01-28 12:27:33
The type-driven development dogma can only be realized by the Curry-Howard dogma, as far as dogmas go.
geekosaur 2017-01-28 12:29:13
guidelines are much better than dogmas
monochrom 2017-01-28 12:29:39
A more tenable reason is "type classes are hard at the beginning".
monochrom 2017-01-28 12:29:55
But that one is readily destroyed by arithmetic already.
monochrom 2017-01-28 12:30:08
Or even merely equality tests.
monochrom 2017-01-28 12:30:54
@quote monochrom fibonacci
lambdabot 2017-01-28 12:30:54
monochrom says: the fibonacci sequence is everywhere in nature, for example haskell tutorials and python tutorials
kadoban 2017-01-28 12:32:01
Haha
pikajude 2017-01-28 12:32:10
fibonacci numbers are quite common in nature; some examples include 1, 2, and 3
monochrom 2017-01-28 12:32:19
haha
monochrom 2017-01-28 12:32:37
@remember pikajude fibonacci numbers are quite common in nature; some examples include 1, 2, and 3
lambdabot 2017-01-28 12:32:37
Good to know.
monochrom 2017-01-28 12:33:03
1 little, 2 little, 3 little rabbits
monochrom 2017-01-28 12:33:12
5 little, 8 little, 13 little rabbits
Tuplanolla 2017-01-28 12:35:20
In fact indexing OEIS turns it into an Online Encyclopedia of Integer Synonyms.
pikajude 2017-01-28 12:35:56
Online Encyclopedia of Rabbit Metaphors
Tuplanolla 2017-01-28 12:36:21
For example 8 is the size of the geometric automorphism group of the three-dimensional hypercube.
Tuplanolla 2017-01-28 12:36:33
Thanks, A000165.
pikajude 2017-01-28 12:37:02
i was trying to remember the size of the geometric automorphism group of the three-dimensional hypercube just the other day
pavolzetor 2017-01-28 12:37:58
monochrom, I tried the partition, the problem is merging. I am going back to board, definitely interesting problem as you sort of want it to be inplace instead of allocating memory
pavolzetor 2017-01-28 12:39:35
also, on my test for trilinear ray tracing haskell was only 10-100 slower than C++ which is encouraging
Tuplanolla 2017-01-28 12:39:52
Have you met `ST`, pavolzetor?
pavolzetor 2017-01-28 12:40:39
no, I had to duckduckgo it
Tuplanolla 2017-01-28 12:41:10
If you really need local mutation of bulk data, that's the way to go.
pavolzetor 2017-01-28 12:41:42
interesting, is it safe to execute in parallel?
pavolzetor 2017-01-28 12:41:54
I mean top level, not inside
Tuplanolla 2017-01-28 12:42:59
The mutation is local, so that's not going to be easy. However doing the same mutation in `IO` is possible and requires locking, stm or other data coherency tricks.
pavolzetor 2017-01-28 12:43:56
that's actually perfect, locally it will run in single thread
pavolzetor 2017-01-28 12:44:15
I parallelize per tiles so this is sufficient