Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→
Page 1 .. 322 323 324 325 326 327 328 329 330 331 332 .. 17990
1,798,985 events total
2021-06-07 12:46:59 <Athas> What's the most efficient way to construct large Text values? E.g. for serialisation.
2021-06-07 12:47:08 <Athas> Or imagine a prettyprinter that doesn't have to be "pretty".
2021-06-07 12:47:23 <ski> you can't e.g. say
2021-06-07 12:47:27 <ski> if ...
2021-06-07 12:47:39 <ski> then x:xs = ...
2021-06-07 12:47:47 <ski> y = ...
2021-06-07 12:47:56 <ski> else (x,y) = ...
2021-06-07 12:48:06 <ski> xs = ...
2021-06-07 12:48:49 × ddellacosta quits (~ddellacos@86.106.121.24) (Ping timeout: 245 seconds)
2021-06-07 12:49:32 <ski> guest61 : did you have a particular situation, or example, of something you wanted to do ?
2021-06-07 12:49:44 larkfisherman joins (~larkfishe@217.75.204.126)
2021-06-07 12:50:14 teaSlurper joins (~chris@81.96.113.213)
2021-06-07 12:51:50 × jakzale quits (uid499518@id-499518.charlton.irccloud.com) (Quit: Connection closed for inactivity)
2021-06-07 12:53:47 dunkeln joins (~dunkeln@94.129.65.28)
2021-06-07 12:54:46 david__ joins (~david@77-171-152-62.fixed.kpn.net)
2021-06-07 12:55:28 <ski> guest61 : if you're talking about using `let'-`in' expressions, inside a conditional (`if'-`then'-`else'), then this is not in any way different from using a `let'-`in' inside any other construct -- the bindings declared between `let' and `in' are only in scope in the portion after the `in', never in scope anywhere else (such as outside your `if'-`then'-`else' expression, that wrapped the `let'-`in'
2021-06-07 12:55:34 <ski> expression)
2021-06-07 12:56:03 shapr joins (~user@108.28.144.11)
2021-06-07 12:56:28 jippiedoe joins (~david@77-171-152-62.fixed.kpn.net)
2021-06-07 12:56:31 david__ parts (~david@77-171-152-62.fixed.kpn.net) ()
2021-06-07 12:58:28 <ski> .. being able to say things like `do {if foo then {f <- [1,2,3] <$ someThing)} else {f <- getList}; ...}' could be quite useful, at times
2021-06-07 13:01:10 <tomsmeding> Athas: what about Data.Text.Lazy.Builder ?
2021-06-07 13:01:16 alx741 joins (~alx741@181.196.69.96)
2021-06-07 13:01:44 <Athas> tomsmeding: ah, yes. Is it much faster than just consing up Texts and mappending them?
2021-06-07 13:02:17 <tomsmeding> don't know, to be honest; but if it weren't, it wouldn't exist, I'd think
2021-06-07 13:06:19 × nattiestnate quits (~nate@180.242.128.159) (Quit: WeeChat 3.1)
2021-06-07 13:06:22 <gentauro> Athas: https://hackage.haskell.org/package/bytestring-0.11.1.0/docs/Data-ByteString-Lazy-Char8.html#v:fromChunks
2021-06-07 13:06:26 <gentauro> ?
2021-06-07 13:06:50 nschoe joins (~quassel@2a01:e0a:8e:a190:5a3:b172:cf1b:f959)
2021-06-07 13:08:26 × v01d4lph4 quits (~v01d4lph4@user/v01d4lph4) (Remote host closed the connection)
2021-06-07 13:08:58 <ski> a more general thing would be to allow something like `do { foo do {x <- ...; y <- ...}; ..x..y.. }', where `foo :: forall a. m a -> n a', `m' and `n' being the two monads in question
2021-06-07 13:08:59 v01d4lph4 joins (~v01d4lph4@user/v01d4lph4)
2021-06-07 13:09:29 notzmv joins (~zmv@user/notzmv)
2021-06-07 13:10:40 × Guest9847 quits (~pera@204.red-79-159-199.dynamicip.rima-tde.net) (Quit: leaving)
2021-06-07 13:12:17 × jneira quits (~jneira@166.red-81-39-172.dynamicip.rima-tde.net) (Ping timeout: 252 seconds)
2021-06-07 13:12:45 × danidiaz quits (~ESDPC@47.61.17.254) (Ping timeout: 252 seconds)
2021-06-07 13:13:18 × v01d4lph4 quits (~v01d4lph4@user/v01d4lph4) (Ping timeout: 252 seconds)
2021-06-07 13:13:21 safinaskar joins (~user@109.252.90.89)
2021-06-07 13:13:28 <safinaskar> hi! do you want a quiz?
2021-06-07 13:13:45 <safinaskar> what does this expression do: s == s?
2021-06-07 13:13:59 <safinaskar> this is code from my real program and i put it there for reason
2021-06-07 13:14:00 ddellacosta joins (~ddellacos@86.106.121.204)
2021-06-07 13:14:07 <safinaskar> why i put it there? what this code does?
2021-06-07 13:14:12 <shryke> seq?
2021-06-07 13:14:32 <safinaskar> shryke: you are very close :)
2021-06-07 13:14:53 <tomsmeding> assuming nothing shadows (==) from base, that runs the (==) method of the Eq instance of the type of `s`, assuming it has any
2021-06-07 13:15:12 <tomsmeding> for any _decent_ Eq instance it will indeed amount to deepseq :p
2021-06-07 13:15:23 <safinaskar> tomsmeding: yes, you are right!
2021-06-07 13:15:49 <safinaskar> tomsmeding: i use it as (s `deepseq` True) replacement without dependency on deepseq!
2021-06-07 13:16:12 <tomsmeding> quite neat
2021-06-07 13:16:20 kenran joins (~kenran@b2b-37-24-119-190.unitymedia.biz)
2021-06-07 13:16:37 <maralorn> tomsmeding: Wasn‘t there some magic for "Seq" that it keeps thunks even when you access all entries?
2021-06-07 13:17:14 <tomsmeding> maralorn: you mean lowercase 'seq'?
2021-06-07 13:17:22 <maralorn> No, uppercase.
2021-06-07 13:17:30 <dminuoso> tomsmeding: Why would (==) amount to deepseq?
2021-06-07 13:17:37 slowButPresent joins (~slowButPr@user/slowbutpresent)
2021-06-07 13:17:53 <kenran> Can I re-export instances that I've imported somehow? I'm doing `import Test.QuickCheck.Instances.ByteString as Bla` and at the top `module Foo (module Bla) where` but I'm getting "the export item Bla exports nothing"
2021-06-07 13:17:54 <tomsmeding> dminuoso: to establish structural equality, you have to evaluate the whole structure, assuming a normal ADT
2021-06-07 13:18:04 jmcarthur joins (~jmcarthur@c-73-29-224-10.hsd1.nj.comcast.net)
2021-06-07 13:18:11 <boxscape> tomsmeding not if the first element of the structure you check is already not equal
2021-06-07 13:18:19 <tomsmeding> maralorn: which Seq do you mean? I know Data.Sequence, but that's probably not what you mean here
2021-06-07 13:18:27 <tomsmeding> boxscape: `s == s`
2021-06-07 13:18:31 <boxscape> oh whoops
2021-06-07 13:18:33 <maralorn> I think fingertrees are constructed in a way that they contain some internal thunks even when they look completely evaluated to the user.
2021-06-07 13:18:34 <dminuoso> tomsmeding: Not trying to be picky, but you'd have to do more than just evaluate..
2021-06-07 13:18:36 <maralorn> Yeah, I mean Data.Sequence
2021-06-07 13:18:45 <boxscape> tomsmeding wait was that what we were talking about?
2021-06-07 13:18:55 <int-e> maralorn: you can have such magic for Eq too... newtype Indifferent a = Indifferent a; instance Eq (Indifferent a) where _ == _ = True
2021-06-07 13:19:14 <boxscape> tomsmeding ah yes, I see it now
2021-06-07 13:19:19 × ddellacosta quits (~ddellacos@86.106.121.204) (Ping timeout: 272 seconds)
2021-06-07 13:20:00 <tomsmeding> maralorn: no idea, but a functional pearl I read recently about the finger tree data structure suggested it's just a normal (though non-uniformly recursive) ADT
2021-06-07 13:20:33 <tomsmeding> dminuoso: fair point, it does more computation, but semantically that shouldn't matter (for structural equality on ADTs)
2021-06-07 13:21:14 <dminuoso> tomsmeding: Oh it just clicked. I didn't understand the presented riddle.
2021-06-07 13:21:31 <dminuoso> It's not about Eq instances, its rather why would `s == s` ever be a useful thing to write.
2021-06-07 13:21:46 <int-e> testing for NaN
2021-06-07 13:21:51 <dminuoso> heh
2021-06-07 13:22:13 <int-e> but I like "poor people's deepSeq"
2021-06-07 13:22:14 <tomsmeding> my trick was always 'length (show s) `seq` ()', but perhaps this one is nicer
2021-06-07 13:22:19 <boxscape> % isNaN s = s /= s
2021-06-07 13:22:19 <yahb> boxscape:
2021-06-07 13:22:23 <tomsmeding> indeed except if you have NaNs...
2021-06-07 13:23:29 ddellacosta joins (~ddellacos@86.106.121.74)
2021-06-07 13:23:35 <dminuoso> Im curious why deepseq would be a good default for Eq though
2021-06-07 13:23:42 <kenran> Oh, it seems like the instances I import are automatically reexported?!
2021-06-07 13:23:53 <dminuoso> kenran: Yes.
2021-06-07 13:23:57 <dminuoso> You cannot not export an instance
2021-06-07 13:24:01 <dminuoso> Open world assumption.
2021-06-07 13:24:06 <kenran> TIL, thanks.
2021-06-07 13:25:06 tromp joins (~textual@dhcp-077-249-230-040.chello.nl)
2021-06-07 13:27:33 <tomsmeding> dminuoso: (==) only becomes deepseq when it's called on two equal arguments
2021-06-07 13:27:40 eggplantade joins (~Eggplanta@2600:1700:bef1:5e10:90fb:e693:9986:91e0)
2021-06-07 13:28:37 × siraben quits (~siraben@user/siraben) (Quit: node-irc says goodbye)
2021-06-07 13:28:37 × kadoban quits (~kadoban@user/kadoban) (Quit: node-irc says goodbye)
2021-06-07 13:28:37 × MatrixTravelerbo quits (~voyagert2@2001:470:69fc:105::22) (Quit: node-irc says goodbye)
2021-06-07 13:28:37 × psydroid quits (~psydroidm@user/psydroid) (Quit: node-irc says goodbye)
2021-06-07 13:28:37 × sm[m] quits (~sm@plaintextaccounting/sm) (Quit: node-irc says goodbye)
2021-06-07 13:28:37 × peddie quits (~peddie@2001:470:69fc:105::25d) (Quit: node-irc says goodbye)
2021-06-07 13:28:37 × ac quits (~aloiscoch@2001:470:69fc:105::65) (Quit: node-irc says goodbye)
2021-06-07 13:28:37 × maerwald[m] quits (~maerwaldm@2001:470:69fc:105::1ee) (Quit: node-irc says goodbye)
2021-06-07 13:28:37 × fgaz quits (~fgaz@2001:470:69fc:105::842) (Quit: node-irc says goodbye)

All times are in UTC.