EvanR 2017-02-09 19:47:20
c_wraith: in that case, a pile of exercise in increasing order of difficulty would be in order, specifically about lazy evaluation
c_wraith 2017-02-09 19:47:35
EvanR: that's true
stephaner 2017-02-09 19:47:53
Am I correct to think use IORef when only one thread modifies the value, and TVar otherwise ?
monochrom 2017-02-09 19:48:14
95% correct.
ertes 2017-02-09 19:48:17
stephaner: what kind of application? i.e. *why* is the value changing?
stephaner 2017-02-09 19:48:18
:-)
monochrom 2017-02-09 19:48:32
There are 5% of the time when you just need atomicModifyIORef. I did.
stephaner 2017-02-09 19:48:39
it's a list of subscribers over network
EvanR 2017-02-09 19:48:50
values never change, even in languages with mutable variables
athan 2017-02-09 19:48:51
stephaner: Also, there are STRefs
ertes 2017-02-09 19:48:58
stephaner: so it changes in response to events?
stephaner 2017-02-09 19:49:09
atyep
athan 2017-02-09 19:49:14
wait.. STRefs are multithread capable, right?
monochrom 2017-02-09 19:49:23
No, STRef is very private.
athan 2017-02-09 19:49:36
D: disregard my naevity
ertes 2017-02-09 19:49:37
stephaner: then you may want to look at FRP as well, unless heavy concurrency is going on
stephaner 2017-02-09 19:49:51
no, it's a pet project for the moment
EvanR 2017-02-09 19:50:05
why would you *not* want FRP when heavy concurrency is going on :(
ertes 2017-02-09 19:50:16
stephaner: what you're describing sounds like a behaviour from FRP
ertes 2017-02-09 19:50:30
EvanR: because none of the currently existing frameworks handle concurrency very well =)
EvanR 2017-02-09 19:50:42
thats a terrible answer!
lpaste_ 2017-02-09 19:50:53
qmm pasted "help requested on matching up the types " at http://lpaste.net/352299
ertes 2017-02-09 19:51:08
EvanR: yeah, sometimes the truth is terrible =)
lpaste_ 2017-02-09 19:51:11
qmm pasted "help requested on matching up the types " at http://lpaste.net/352300
stephaner 2017-02-09 19:53:23
monochrome: what did you mean by STRef is very private ?
osa1 2017-02-09 19:53:52
is the freer monad paper a continuation of the extensible effects paper?
monochrom 2017-02-09 19:54:00
Even within one thread, you can't always access it.
monochrom 2017-02-09 19:54:44
If you write "runST ( ... v <- newSTRef xxx ....)" v is invisible outside that runST block.
qmm 2017-02-09 19:54:49
strange, i received an error the first time i posted
phadej 2017-02-09 19:57:09
qmm: first V.zip should bbe just (,) ?
phadej 2017-02-09 19:58:54
or maybe not, my mental type-checker cannot handle that
qmm 2017-02-09 19:59:15
same
monochrom 2017-02-09 19:59:22
I have doubt about the part V.zip (V.head v) $ V.singleton ["foo"]
qmm 2017-02-09 19:59:44
phadej: the second argument to V.cons drops the head of the Vector and then adds urls "to the beginning"
qmm 2017-02-09 20:00:10
it kind of ends up with something like [("url string", "the rest of the csv row"), etc.]
monochrom 2017-02-09 20:00:32
What is the type of urls?
qmm 2017-02-09 20:00:41
the first argument is mainly just to put the dropped row back into the vector
qmm 2017-02-09 20:00:56
it's a list of strings
qmm 2017-02-09 20:01:00
["String"]
qmm 2017-02-09 20:01:02
er..
qmm 2017-02-09 20:01:04
[String]
phadej 2017-02-09 20:01:05
qmm: I'd suggest using lenses to do such adhoc editing :P
monochrom 2017-02-09 20:01:19
Not even [ByteString]?
qmm 2017-02-09 20:01:24
oh, i'm wrong...
qmm 2017-02-09 20:01:25
urls :: [[Char]]
phadej 2017-02-09 20:01:46
original & ix 0 %~ ...
qmm 2017-02-09 20:01:59
i'm right :)
monochrom 2017-02-09 20:02:35
OK, V.drop 1 v has type Vector (Vector ByteString).
monochrom 2017-02-09 20:03:16
No, wait, why are you even zipping? Not the right thing to do.
monochrom 2017-02-09 20:03:25
Or rather, not the right way to get what you want.
qmm 2017-02-09 20:03:49
yeah, it seems like this is going to be a nightmare to sort back together
qmm 2017-02-09 20:04:03
i'm zipping because i asked a question earlier
monochrom 2017-02-09 20:04:07
You're supposed to be V.zipWith V.cons, if anything
qmm 2017-02-09 20:04:22
question asked earlier: i want the equivalent of this in haskell without the crashing :) https://paste.pound-python.org/show/OhdCM4AmuTnML3xSVruP/
monochrom 2017-02-09 20:04:30
Or V.zipWith V.append, depending on the detail.
monochrom 2017-02-09 20:07:48
Which one are you more familiar with, [] or Vector?
qmm 2017-02-09 20:07:54
[]
qmm 2017-02-09 20:08:12
today was the first day i came across Data.Vector
monochrom 2017-02-09 20:08:15
OK, aeson can totally do [[ByteString]]. You should start with that first.
osa1 2017-02-09 20:08:56
which library do you use for MTL-style logging monad class (extra points if it provides a transfomer too) ?
monochrom 2017-02-09 20:09:04
Later you can go Vector (Vector ByteString) after you understand the basic algorithm in terms of []. It will be a tractable substitution.
qmm 2017-02-09 20:09:14
monochrom: Vector seems more familiar than Aeson
qmm 2017-02-09 20:09:18
i haven't used aesone before
qmm 2017-02-09 20:09:30
the reason i think it seems more familiar is that it has familiar functions from []
qmm 2017-02-09 20:09:39
maybe they don't work how i imagine though
monochrom 2017-02-09 20:10:20
aeson is pretty much unbiases and neutral between "list vs vector, which one?". So start with the easier one.
monochrom 2017-02-09 20:10:58
I can continue with Vector if you want. I am neutral too. But I want you to know you have a choice.
monochrom 2017-02-09 20:11:35
Do not rely on slight pretexts such as "I saw one Vector-using example".
monochrom 2017-02-09 20:11:46
(one is not enough. a million would be.)
qmm 2017-02-09 20:12:46
i'm open to the easier solution, whichever one that is
monochrom 2017-02-09 20:12:49
In terms of list, you will have to worry about this:
monochrom 2017-02-09 20:13:01
> zip [1,2,3,4] ["x"]
lambdabot 2017-02-09 20:13:03
[(1,"x")]
monochrom 2017-02-09 20:13:18
It will truncate not extend. This will not be what you want.
monochrom 2017-02-09 20:13:47
The same issue will happen to V.zip. You understand one version, you understand both.
qmm 2017-02-09 20:13:49
> zip ["x"] [1,2,3,4]
lambdabot 2017-02-09 20:13:52
[("x",1)]
monochrom 2017-02-09 20:13:57
Same problem.
qmm 2017-02-09 20:14:00
that's what i want
qmm 2017-02-09 20:14:10
i only have about 50 urls but about 1000 rows
qmm 2017-02-09 20:14:26
i want to insert about 50 urls and leave the rest of the rows untouched
monochrom 2017-02-09 20:14:39
Are you sure? Because your example shows unpaired ['qux'] and ['zoo'] being preserved.
qmm 2017-02-09 20:14:48
yep, that's exactly what i want
monochrom 2017-02-09 20:14:58
whereas zip will lose things seriously
qmm 2017-02-09 20:16:28
> zip [1,2,3,4] ["url1", "url2"]
lambdabot 2017-02-09 20:16:31
[(1,"url1"),(2,"url2")]
qmm 2017-02-09 20:16:36
not desired
qmm 2017-02-09 20:16:46
> zip ["url1", "url2"] [1,2,3,4]
lambdabot 2017-02-09 20:16:49
[("url1",1),("url2",2)]
qmm 2017-02-09 20:16:57
er..
qmm 2017-02-09 20:17:09
sorry, i want the 3 and 4
qmm 2017-02-09 20:17:43
i want "unpaired ['qux'] and ['zoo'] being preserved."
qmm 2017-02-09 20:18:02
guess 'zip' is out
qmm 2017-02-09 20:18:34
(sorry for the confusion)
monochrom 2017-02-09 20:19:25
@let emerge xs yss = zipWith (++) (map (:[]) xs ++ repeat ([])) yss
lambdabot 2017-02-09 20:19:27
Defined.
monochrom 2017-02-09 20:19:35
> emerge ["1", "2"] [["foo"], ["bar"], ["john"]]
lambdabot 2017-02-09 20:19:38
[["1","foo"],["2","bar"],["john"]]
monochrom 2017-02-09 20:20:23
But you need to know that if you now encode that table into csv...
monochrom 2017-02-09 20:20:44
First column will be "1", "2", "john"
monochrom 2017-02-09 20:21:11
And actually I am not sure whether aeson will like the fact that the 2nd column is shorter.
monochrom 2017-02-09 20:21:40
I'm wondering if you should want [["1","foo"],["2","bar"],["", "john"]] instead.
monochrom 2017-02-09 20:23:04
(:[]) is probably too nerdy. It means (\x -> x:[]) i.e. (\x -> [x])
qmm 2017-02-09 20:23:40
that seems very much ideal
qmm 2017-02-09 20:23:54
[["1","foo"],["2","bar"],["","john"]]
monochrom 2017-02-09 20:24:28
OK, that's an easy change.
monochrom 2017-02-09 20:24:33
@undefine
lambdabot 2017-02-09 20:24:33
Undefined.
monochrom 2017-02-09 20:24:44
@let emerge xs yss = zipWith (++) (map (:[]) xs ++ repeat ([""])) yss
lambdabot 2017-02-09 20:24:46
Defined.
monochrom 2017-02-09 20:24:51
> emerge ["1", "2"] [["foo"], ["bar"], ["john"]]
lambdabot 2017-02-09 20:24:53
[["1","foo"],["2","bar"],["","john"]]
qmm 2017-02-09 20:25:07
[["url", "stuff", "another column", "colum4"], ["url2", "morestuff", ...]]
stephaner 2017-02-09 20:25:34
do you know if it is posible to filter out the join and quit messages on the irc channel ?
qmm 2017-02-09 20:25:45
stephaner: which irc client
stephaner 2017-02-09 20:25:51
freenode
stephaner 2017-02-09 20:26:00
I should have a dedicated application ?
qmm 2017-02-09 20:26:01
irssi, weechat, etc
monochrom 2017-02-09 20:26:03
Depends on what software you use for irc.
stephaner 2017-02-09 20:26:09
okay
qmm 2017-02-09 20:26:28
for irssi, it's /ignore -channels #chan1,#chan2,#chan3 * JOINS PARTS QUITS NICKS
monochrom 2017-02-09 20:26:38
You using the web page thing? Look around there, it may have a setting. Or not.
monochrom 2017-02-09 20:27:34
> emerge ["1", "2"] [["foo", "d"], ["bar", "e"], ["john", "son"]]
stephaner 2017-02-09 20:27:35
perfect! thanks. it is indeed an option in FreeNode.net
lambdabot 2017-02-09 20:27:36
[["1","foo","d"],["2","bar","e"],["","john","son"]]
bollu 2017-02-09 20:29:38
cocreature: how stable are the LLVM haskell bindings?
qmm 2017-02-09 20:29:40
guess i should look into V.toList
monochrom 2017-02-09 20:30:09
No, if you want Vector, keep it Vector all along. Don't make an XY problem.
monochrom 2017-02-09 20:30:44
zip just becomes V.zip, map just becomes V.map. repeat is harder, I'm looking for a substitute.
qmm 2017-02-09 20:30:44
something has to be converted
monochrom 2017-02-09 20:31:13
Are you sure?
qmm 2017-02-09 20:31:17
urls has type [String]
monochrom 2017-02-09 20:31:47
You know, you need to convert String to ByteString too.
cocreature 2017-02-09 20:31:53
bollu: our fork or llvm-general?
qmm 2017-02-09 20:32:08
map (\s -> "https://myurl.com/images") ++ s) (drop 2 $ getDirectoryContents "./static/images")
cocreature 2017-02-09 20:32:22
bollu: also what exactly do you mean by "stable"?
qmm 2017-02-09 20:32:22
that's how urls is defined
qmm 2017-02-09 20:32:59
oops, forgot to add the last forward slash
qmm 2017-02-09 20:34:44
csvData <- BL.ReadFile "./static/data.csv" ; case decode NoHeader csvDtaa :: String (V.Vector (V.Vector BL.ByteString)) of ...
qmm 2017-02-09 20:35:08
(typo just now)
osa1 2017-02-09 20:35:15
how do I actually print a LogStr in when defining a logger function for LoggingT (monad-logger) ?
bollu 2017-02-09 20:36:15
cocreature: well
bollu 2017-02-09 20:36:33
cocreature: I'm building LLVM with polly, which is an LLVM pass. Can I use the given FFI to target this LLVM?
qmm 2017-02-09 20:37:08
osa1: logDebug ?
qmm 2017-02-09 20:37:11
Generates a function that takes a Text and logs a LevelDebug message. Usage:
qmm 2017-02-09 20:37:18
$(logDebug) "This is a debug log message"
osa1 2017-02-09 20:37:50
qmm: no, I mean in the function with type `(Loc -> LogSource -> LogLevel -> LogStr -> IO ())` to run LoggingT
qmm 2017-02-09 20:37:51
oh, wrong type, nm
osa1 2017-02-09 20:39:16
do I need fast-logger for that?
qmm 2017-02-09 20:39:27
fast-logger has this in it
qmm 2017-02-09 20:39:27
pushLogStr :: LoggerSet -> LogStr -> IO ()
qmm 2017-02-09 20:39:31
"Writing a log message to the corresponding buffer.
qmm 2017-02-09 20:39:46
i'll be quiet
cocreature 2017-02-09 20:40:34
bollu: not easily iirc. the haskell bindings have an ADT that lists passes and if your pass is not in there you're out of luck. fixing this is on my todolist but I haven't gotten around to it yet. if you mess with the external modules (which need to be exposed first) you could probably achieve what you want relatively easily
bollu 2017-02-09 20:41:02
cocreature: I see
bollu 2017-02-09 20:41:10
cocreature: any way I can help with the effort?
cocreature 2017-02-09 20:43:14
bollu: mostly we need to come up with a decent API that allows users to supply custom passes without modifying llvm-hs. I don't yet know how that API would look like so any ideas are appreciated. it might also make sense to do this directly for llvm's new pass manager since otherwise we are going to have to rethink this relatively soon.
cocreature 2017-02-09 20:43:39
bollu: just opening an issue and adding any ideas you have to that would already be helpful