Search Haskell Channel Logs

Saturday, March 4, 2017

#haskell channel featuring oPn7, MarcelineVQ, Nikola, thatguy, kmelva_, Theophane,

cocreature 2017-03-04 05:45:24
Nikola: I think it's just rarely used. personally I never needed that function
Nikola 2017-03-04 05:49:03
cocreature: So you always use a database or other service to store data ?
cocreature 2017-03-04 05:49:10
Nikola: I would suspect that a PR to the unix package adding this would be accepted
cocreature 2017-03-04 05:49:24
Nikola: no I just don't care enough about when files are written to call "sync(2)"
Nikola 2017-03-04 05:50:09
cocreature: And how _do_ you store the data ? :-)
cocreature 2017-03-04 05:50:25
Nikola: I just write to a file and let the os decide when it syncs :)
geekosaur 2017-03-04 05:55:53
Nikola, I would question using sync(), it is a very blunt hammer that impacts the entire system
geekosaur 2017-03-04 05:56:31
unless the entire system is guaranteed to be dedicated to your application, rethink that
oPn7 2017-03-04 05:56:35
hello guys, where am i doing wrong here about indentations ? https://paste.kde.org/psn0eczll can anybody help ?
geekosaur 2017-03-04 05:56:59
because it WILL trash performance systemwide
Nikola 2017-03-04 05:57:27
Sure - fsync is fine - thanks - But I mean more high-level: "How do you store data" ... say you have a web application receiving lots of messages ... I am looking into append-only event store solutions, like e.g. "java-dirty" (dead-simple object serialization
geekosaur 2017-03-04 05:58:19
oPn7, first thing I see is "-h"::String is both redundant and illegal without ScopedTypeVariables
geekosaur 2017-03-04 05:58:30
(also, you should include full error messages with this kind of paste)
monochrom 2017-03-04 05:59:01
Yeah, I don't think I see indentation errors either.
Nikola 2017-03-04 05:59:36
but that in haskell ... and I guess I'd somehow like to make sure the store is consistent and persisted to disk at some point
geekosaur 2017-03-04 05:59:37
I think it also needs parentheses, and when they are missing could well confuse the parser in ways that makes it suggest bad indentation just as a "I have no clue, maybe this?"
Nikola 2017-03-04 05:59:37
https://github.com/mrwilson/java-dirty/blob/master/java-dirty/src/main/java/uk/co/probablyfine/dirty/Store.java
oPn7 2017-03-04 05:59:58
i added those String things because it shows that they are not String
geekosaur 2017-03-04 06:00:02
Nikola, that is what fsync is for
geekosaur 2017-03-04 06:00:26
you want to sync that store, not every single dirty buffer on the system
Nikola 2017-03-04 06:00:48
geekosaur: yep, but fsync is not in the standard library either (neither is sync())
geekosaur 2017-03-04 06:00:54
depending on other activity, your data may actually end up being delayed
oPn7 2017-03-04 06:00:58
geekosaur: excat error message is "parse error (possibly incorrect indentation or mismatched brackets)"
geekosaur 2017-03-04 06:01:17
cocreature pointed you to https://hackage.haskell.org/package/unix-2.7.2.1/docs/System-Posix-Unistd.html#v:fileSynchronise
oPn7 2017-03-04 06:01:18
line 11,9
geekosaur 2017-03-04 06:01:19
that is fsync
monochrom 2017-03-04 06:01:55
Oh interesting, there is a parse error.
geekosaur 2017-03-04 06:01:59
oPn7, yes, that's the "I'm completely lost" error
oPn7 2017-03-04 06:02:06
:D
oPn7 2017-03-04 06:02:18
what that means ?
geekosaur 2017-03-04 06:02:31
what I said and you apparently only saw the last part of
Nikola 2017-03-04 06:02:34
oh ok - so unix-2.7.2.1 is there in any standard installation ?
cocreature 2017-03-04 06:02:53
Nikola: yep
kmelva_ 2017-03-04 06:03:00
is there something "beyond" algebraic data types as in Haskell? analoguus to what dependent types are to Haskell?
geekosaur 2017-03-04 06:03:11
Nikola, on a unixlike system, yes
geekosaur 2017-03-04 06:03:18
should be obvious it wont be on windows
Nikola 2017-03-04 06:03:18
how do I know what is standard and what not ?
monochrom 2017-03-04 06:03:55
OK, it is parentheses. (h::String)
geekosaur 2017-03-04 06:04:05
Nikola, https://downloads.haskell.org/~ghc/8.0.1/docs/html/libraries/frames.html
geekosaur 2017-03-04 06:04:11
libraries that come with ghc
cocreature 2017-03-04 06:04:12
Nikola: in general I would say that the what is part of the standard library and the packages bundled with ghc is not particularly important. every project is going to depend on a bunch of external libraries
geekosaur 2017-03-04 06:04:24
(I should point to 8.0.2 buut someone forgot to upload it yet again :/ )
geekosaur 2017-03-04 06:05:05
also you should understand that ghc ships with *as little as possible* because ghc's haskell code has some nasty dependency gotchas in the name of performance
geekosaur 2017-03-04 06:05:22
so pretty much everything requires external libraries and trying to avoid them is a fool's errand
geekosaur 2017-03-04 06:05:47
(anything that ships with ghc is not uphgradeable, basically, except by replacing ghc)
MarcelineVQ 2017-03-04 06:06:08
geekosaur: 8.0.2 is there it just didn't replace /latest/
geekosaur 2017-03-04 06:06:36
I swapped 8.0.2 for 8.0.1 and got a 404
geekosaur 2017-03-04 06:07:00
oh, they dropped the frames interface :(
geekosaur 2017-03-04 06:07:11
or renamed it maybe
thatguy 2017-03-04 06:15:17
If I am writing a game in haskell and I want to save the positions of all of my agents and they change all the time, is it really a good idea to have immutable data structures then?
oPn7 2017-03-04 06:15:47
geekosaur: can you look at this ? https://paste.kde.org/pwyj0nze5
Theophane 2017-03-04 06:15:53
thatguy: you could use the State monad
geekosaur 2017-03-04 06:16:51
oPn7, for starters, once you lose the unnecessary type annotations, you don;t need the parentheses either
geekosaur 2017-03-04 06:17:42
second: getArgs is IO [[Char]], but you are using its result as if it were IO [Char]
geekosaur 2017-03-04 06:19:11
it is getArgs not getArg. it returns a *list* of arguments, not a single argument or a string containing multiple arguments
geekosaur 2017-03-04 06:23:27
oPn7, for your use case, the patterns you want are probably ("-h":[]), ("-d":[]), and _
geekosaur 2017-03-04 06:23:54
although you could also write the first two as ["-h"] and ["-b"]
geekosaur 2017-03-04 06:24:03
er -b not -d in that first one, sorry
oPn7 2017-03-04 06:25:01
okey
oPn7 2017-03-04 06:26:10
there, that says, i expect [Char] but you gave me Char ? Couldn't match type 'Char' with '[Char]'
geekosaur 2017-03-04 06:28:04
please pastebin current code and full error again
oPn7 2017-03-04 06:30:58
http://pastebin.com/Mh21YuQ0
oPn7 2017-03-04 06:31:07
sorry :D pastebin is blocked here
oPn7 2017-03-04 06:31:24
used proxy for that
geekosaur 2017-03-04 06:33:14
"pastebin" does not mean exactly pastebin.com and in fact many of us prefer you not use that. did paste.kde.org die?
geekosaur 2017-03-04 06:34:42
never mind, I will try to remember to precisely identify the nopaste host from now on
oPn7 2017-03-04 06:35:09
okey :D
geekosaur 2017-03-04 06:36:17
so you said that gave you a mismatch on Char vs [Char] but the error talks about IO () and SP.CreateProcess...
geekosaur 2017-03-04 06:36:38
the problem here is that "shell" does not do what you think
oPn7 2017-03-04 06:36:44
yeah after your suggestions [] that part is okey
oPn7 2017-03-04 06:37:00
yeah i realized that. i used createProcess $ ...
oPn7 2017-03-04 06:37:06
but another error
geekosaur 2017-03-04 06:37:08
it specifies whether to use a shell or direct exec in a process creation specifier
geekosaur 2017-03-04 06:37:21
you probably want to use system
geekosaur 2017-03-04 06:37:32
@index system
lambdabot 2017-03-04 06:37:33
System.Process, System.Cmd
geekosaur 2017-03-04 06:38:09
unless you are actually intending to capture output or something
oPn7 2017-03-04 06:38:44
i should use System.Cmd
geekosaur 2017-03-04 06:39:21
you already have System.Process imported...
oPn7 2017-03-04 06:40:36
geekosaur: https://paste.kde.org/pzmpxe3bm
geekosaur 2017-03-04 06:41:29
oPn7, yes, this is why I suggested system instead of CreateProcess
geekosaur 2017-03-04 06:41:38
you have to handle the result of CreateProcess
geekosaur 2017-03-04 06:42:22
it is giving you a tuple of possible filehandles and a result status, but you are using it in a place that expects "nothing" ( (), the degenerate tuple aka "unit")