Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→
Page 1 .. 216 217 218 219 220 221 222 223 224 225 226 .. 5022
502,152 events total
2020-09-26 05:21:39 sambo joins (6bb5131e@107.181.19.30)
2020-09-26 05:21:41 × sambo quits (6bb5131e@107.181.19.30) (Remote host closed the connection)
2020-09-26 05:22:14 <fraktor> Ah, it's in GHC.Exts. I think that's acceptable.
2020-09-26 05:22:22 takuan joins (~takuan@178-116-218-225.access.telenet.be)
2020-09-26 05:23:37 <fraktor> c_wraith: Is this better? https://paste.tomsmeding.com/dfCZuFjh
2020-09-26 05:24:01 <c_wraith> that is a *lot* better, yes. :)
2020-09-26 05:24:09 × mpereira quits (~mpereira@2a02:810d:f40:d96:5151:9344:10a3:da64) (Ping timeout: 272 seconds)
2020-09-26 05:25:07 <fraktor> applyMove also makes me sad
2020-09-26 05:27:09 <c_wraith> that's one of those cases where a do block might actually read better.
2020-09-26 05:27:25 <c_wraith> fromMaybe board $ do ...
2020-09-26 05:28:45 × jdgr quits (601c428b@gateway/web/cgi-irc/kiwiirc.com/ip.96.28.66.139) (Ping timeout: 240 seconds)
2020-09-26 05:28:47 <fraktor> Hmm. Let's see
2020-09-26 05:29:45 <dsal> liftM looks weird to me. Is that fmap?
2020-09-26 05:29:50 <c_wraith> yes
2020-09-26 05:32:11 <fraktor> Yeah I should use fmap.
2020-09-26 05:32:20 <dsal> I'd probably write `emptyIndex board = fst <$> Map.lookupMin . Map.filter (== 0) board`
2020-09-26 05:32:37 <c_wraith> yeah, I ran through it... applyMove gets a lot cleaner if you make most of it a do block
2020-09-26 05:32:43 <dsal> Though my brain compiler is rejecting that.
2020-09-26 05:32:58 <fraktor> That is so much better
2020-09-26 05:32:59 <c_wraith> since you get to drop a lot of stuff going on to maintain Maybe values
2020-09-26 05:33:03 AmberJ_ joins (~AmberJ_@195.140.213.38)
2020-09-26 05:33:17 <fraktor> https://paste.tomsmeding.com/MO0geafX
2020-09-26 05:33:56 <c_wraith> Yep. I think that's an improvement
2020-09-26 05:34:08 <fraktor> I'm happy with that function now. It's relatively easy to understand
2020-09-26 05:36:21 <dsal> I don't like return, but it's not incorrect. :)
2020-09-26 05:36:40 <Faker> dsal: How ?
2020-09-26 05:36:51 <dsal> Faker: what do you have?
2020-09-26 05:37:33 <fraktor> I'm guessing `Just`?
2020-09-26 05:37:39 <c_wraith> nah, pure
2020-09-26 05:37:46 <dsal> I'm a `pure`ist
2020-09-26 05:37:48 <c_wraith> but I don't think the difference matters
2020-09-26 05:37:52 <dsal> It doesn't.
2020-09-26 05:38:12 Guest26 joins (a181464f@gateway/web/cgi-irc/kiwiirc.com/ip.161.129.70.79)
2020-09-26 05:38:23 <fraktor> By the way, I just wrote `groupOn` so I wouldn't have to import a GHC extension
2020-09-26 05:38:46 <fraktor> `groupOn f = groupBy (\a b -> f a == f b)`
2020-09-26 05:39:01 <Faker> receives a word and returns the original word in tuple and uppercase
2020-09-26 05:39:21 <fraktor> Faker: What do you mean the "original word in tuple"?
2020-09-26 05:39:29 <Guest26> hello, I have a question about using Haskell to exchange data with a web page
2020-09-26 05:39:30 <Faker> the same word
2020-09-26 05:39:40 <fraktor> Oh I see. So it would be (original, uppercase)?
2020-09-26 05:39:52 <dsal> fraktor: yeah, it's not an important detail, but little things make big differences.
2020-09-26 05:39:57 <Faker> Exactly!
2020-09-26 05:40:26 <Guest26> there are several options for using Haskell for the web page also, but my question is about the interface
2020-09-26 05:40:26 <fraktor> http://hackage.haskell.org/package/base-4.14.0.0/docs/Data-Char.html This might have what you need, Faker
2020-09-26 05:40:35 <Faker> i dont know how to use uppercase yet
2020-09-26 05:40:53 <Faker> fraktor i will see
2020-09-26 05:41:10 <Guest26> most online tutorials suggest something like SQL - but there are also here several options that just use Haskell
2020-09-26 05:41:25 <dsal> Faker: You gave a really imprecise description of your goal. What code do you have? What signature?
2020-09-26 05:41:35 <dsal> Returning your input isn't usually very useful. Anyone who calls a function with input already has the input.
2020-09-26 05:41:56 <Faker> The input will be a string
2020-09-26 05:42:11 <dsal> Guest26: haskell and SQL aren't the same genus. It's not clear what you're trying to do.
2020-09-26 05:42:15 nbloomf joins (~nbloomf@2600:1700:83e0:1f40:cc55:612b:5adc:f6f1)
2020-09-26 05:42:41 <fraktor> Faker: I'm also confused why you would want to return a tuple when the caller can just do `(str, myFunc str)`
2020-09-26 05:43:12 <Guest26> for a test case, i would like to visualise some data sent through a database. in the browser i would like to use some libraries or js to make the visualisation nicer
2020-09-26 05:43:35 <dsal> Guest26: Sounds like a plan. I do that sometimes.
2020-09-26 05:43:47 <Guest26> dsal: i thought SQL could be a good way to send data between languages
2020-09-26 05:44:05 <dsal> SQL isn't a transport or interchange of any sort.
2020-09-26 05:44:14 <dsal> It's just some kind of structured query language.
2020-09-26 05:44:21 <Guest26> but since the language im sending it from is Haskell, i thought maybe a haskell replacement for SQL would work
2020-09-26 05:44:42 <fraktor> Guest26: what do you mean "a Haskell replacement for SQL"? They do fundamentally different things
2020-09-26 05:44:50 <Guest26> dsal: just because both languages normally would be able to interface with an SQL server
2020-09-26 05:44:53 <fraktor> What is the flow of data/queries that you're envisioning?
2020-09-26 05:45:50 <Guest26> something like, a server writing the number of users online, and the webpage displaying this as a graph that can be updated by refreshing the page
2020-09-26 05:46:06 mirrorbird joins (~psutcliff@m83-187-185-252.cust.tele2.se)
2020-09-26 05:46:24 <fraktor> I see. So you're thinking of using a Haskell backend to mediate between a SQL server that has that information, and a web frontend?
2020-09-26 05:46:46 <Guest26> im not sure. it seems like haskell could even replace the web frontend aswell
2020-09-26 05:46:53 <fraktor> What? how?
2020-09-26 05:47:11 <Guest26> and then, it might not need SQL at all, because its not "communication between languages"
2020-09-26 05:47:20 <Guest26> which i thought i would need to send it to HTML
2020-09-26 05:47:22 <fraktor> That's... that's not what SQL does.
2020-09-26 05:47:23 <dsal> Whatever you mean by "send SQL" is almost certainly wrong.
2020-09-26 05:47:48 × sand_dull quits (~theuser@185.217.69.182) (Ping timeout: 256 seconds)
2020-09-26 05:47:50 <fraktor> SQL is a way of communicating with a database specifically. It's not a serialization format like JSON or XML. It describes queries, not data.
2020-09-26 05:48:01 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2020-09-26 05:48:23 <Faker> Fraktor how to use toUpper :: Char -> Char ?
2020-09-26 05:48:24 jedws joins (~jedws@121.209.139.222)
2020-09-26 05:48:30 <dsal> > toUpper 'x'
2020-09-26 05:48:33 <lambdabot> 'X'
2020-09-26 05:48:57 <dsal> It takes a Char. It returns a Char.
2020-09-26 05:49:13 <Faker> Variable not in scope: toUpper :: Char -> t
2020-09-26 05:49:20 <Faker> Give me this error
2020-09-26 05:49:28 <Guest26> fraktor: yes, i mean there would be an SQL database, and both the HTML page, and the haskell program that needs to send data, could use the SQL database as a gobetween
2020-09-26 05:49:28 <fraktor> What code are you running on it?
2020-09-26 05:49:51 × Wuzzy quits (~Wuzzy@p5b0df9fe.dip0.t-ipconnect.de) (Remote host closed the connection)
2020-09-26 05:49:53 <fraktor> Guest26: Oh! You mean that the Haskell application is writing to the database, and the HTML page is reading from it?
2020-09-26 05:49:58 <Guest26> yes!
2020-09-26 05:50:02 <dsal> Faker: Sounds like you didn't import it. Are you trying to learn Haskell by trial and error?
2020-09-26 05:50:07 <fraktor> Okay. I think I understand now.
2020-09-26 05:50:34 sand_dull joins (~theuser@185.217.69.182)
2020-09-26 05:50:37 <fraktor> Are you talking specifically about monitoring users though? More generally, is the data that you're using all metric-based?
2020-09-26 05:50:44 <Guest26> this seems like it might not be needed however, since if the haskell is also doing the webpage, then there might be an easier way to send the data
2020-09-26 05:51:14 <fraktor> Guest26: If the Haskell program is hosting the web page and acting as the backend, then you can send information through a serialization format. JSON is really easy to use in this use case.
2020-09-26 05:51:25 <Faker> dsal the import will be import Data.Char ?
2020-09-26 05:51:26 <Guest26> fraktor: i think most generally i would be sending json serializable data - but for the sake of example could just be a vector of doubles
2020-09-26 05:51:47 <Guest26> or, just a double, as thats easy to make a time dependent graph of
2020-09-26 05:52:29 <fraktor> Guest26: If you haven't, I would look into Prometheus. It's a tool specifically used for general metrics collection and querying, and is super widely used. It might not be to your use case, but I'd at least consider not reinventing the wheel.
2020-09-26 05:52:33 <Guest26> im not sure what you meant metric-based, does that answer the question?
2020-09-26 05:53:08 <Guest26> suppose i want to send a random number and visualise that in a time dependant graph
2020-09-26 05:53:31 <Guest26> im not sure if it being a user count is confusing things
2020-09-26 05:53:33 <fraktor> I should have said "time-series metrics." So for example, the total number of requests served, the number of active connections, percentiles for response times for your server, and so on.

All times are in UTC.