Squarism 2017-02-07 07:57:20
ive managed to avoid using classes. Is it possible to define a class wo methods? I just wanna make a "generic" datastructure that holds channels who's id is just an instance of a certain class (that doesnt need any methods except those of Eq) . Some "sketch" http://lpaste.net/352186
Squarism 2017-02-07 07:57:42
(...avoid working alot with own made classes that is)
AWizzArd 2017-02-07 07:59:59
In the section about applicative functors the Learn You A Haskell book says: "pure should take a value of any type and return an applicative functor with that value inside it. When we say inside it, we're using the box analogy again, even though we've seen that it doesn't always stand up to scrutiny." – What is "wrong" with the box-analogy?
AWizzArd 2017-02-07 08:00:15
*in* the Learn You A Haskell book
dolio 2017-02-07 08:03:02
IO isn't a box.
AWizzArd 2017-02-07 08:06:41
dolio: because it is defined via newtype?
dolio 2017-02-07 08:07:05
No.
Sonolin 2017-02-07 08:07:16
well, technically IO is a box around the RealWorld# state var, right?
dolio 2017-02-07 08:07:18
It just isn't a box.
geekosaur 2017-02-07 08:07:25
RealWorld# doesn't exist
nshepperd 2017-02-07 08:07:28
AWizzArd: an IO String doesn't contain a String
dolio 2017-02-07 08:07:34
It's not a container.
monochrom 2017-02-07 08:07:59
@quote monochrom contain
lambdabot 2017-02-07 08:07:59
monochrom says: new catchy thing to say: an IORef Int contains an Int in the same sense as an IO Int contains an Int
koala_man 2017-02-07 08:08:30
@quote /bin/ls
lambdabot 2017-02-07 08:08:30
shachaf says: getLine :: IO String contains a String in the same way that /bin/ls contains a list of files
nshepperd 2017-02-07 08:08:32
it 'produces' a String, when executed
nshepperd 2017-02-07 08:08:37
monochrom: :(
AWizzArd 2017-02-07 08:10:06
Okay good, makes sense.
monochrom 2017-02-07 08:10:15
But more seriously, if IO String "contained" a string, then it would have to contain the string that I will enter as input tomorrow, a string that even I don't contain.
dolio 2017-02-07 08:23:21
I think `IO String` has more ways of not containing a string than `IORef String`. :)
ph88 2017-02-07 08:24:57
if i remove line 3 to 6 in this paste https://paste.fedoraproject.org/550692/86495428/ i get modifyTspace not in scope on line 2, anyone know why that happens ?
geekosaur 2017-02-07 08:25:34
ph88, where scopes over a single definition. line 7 begins a new definition
ph88 2017-02-07 08:25:52
no other choice than to make a top-level function here ?
geekosaur 2017-02-07 08:26:29
you could rephrase it as a single definition with a case
ph88 2017-02-07 08:28:42
oh ye that works nicely
ph88 2017-02-07 08:28:56
:r
Phyx- 2017-02-07 08:38:00
https://phabricator.haskell.org/P144 anyone see anything weird here? The process starts but never does anything. If I don't try to pipe the stdout it does work
ertes 2017-02-07 08:38:43
Phyx-: don't use hClose
ertes 2017-02-07 08:38:58
or preferably: don't use lazy input (hGetContents)
Squarism 2017-02-07 08:39:05
I read here that constructor constraints are not supported or encouraged. See https://wiki.haskell.org/Data_declaration_with_constraint . What should one use instead?
ertes 2017-02-07 08:39:44
Squarism: constraints at the use sites
ertes 2017-02-07 08:39:47
you will use them anyway
Phyx- 2017-02-07 08:39:49
ertes: it doesn't get there, so that's not my immediate problem..
Squarism 2017-02-07 08:40:49
ertes: you mean, in functions that use the types ?
ertes 2017-02-07 08:41:26
Phyx-: perhaps a buffering issue? but i don't see how it would apply to your example
ertes 2017-02-07 08:42:37
Phyx-: oh, if your program attempts to write to its stdout, but the handle is already closed, the other possibility is that it receives a SIGPIPE or SIGHUP or something (i can't remember which of those)
ertes 2017-02-07 08:43:24
Phyx-: so removing hClose might fix your problem anyway
Phyx- 2017-02-07 08:43:50
ertes: hm, maybe, but I do wait till process termination to close the handle. But i'll try removing it
ertes 2017-02-07 08:44:15
Phyx-: ah, i don't know if it's correct to do that
ertes 2017-02-07 08:44:28
the process writes, buffer runs full, but nobody is reading
ertes 2017-02-07 08:44:49
the other side is waiting for the process to finish… so the processes wait for each other
Phyx- 2017-02-07 08:45:09
that is all assuming the process writes. currently, the process starts and is immediately idle