Logs: freenode/#haskell
| 2020-10-26 14:34:19 | <ixlun> | How would I generate a random number for every elm in a list to convert to a tuple? |
| 2020-10-26 14:34:51 | <ixlun> | (,) <$> [0,1,2,3] <*> genWord64 would just give me the same val every time |
| 2020-10-26 14:34:51 | <merijn> | :t randoms |
| 2020-10-26 14:34:53 | <lambdabot> | (Random a, RandomGen g) => g -> [a] |
| 2020-10-26 14:34:57 | hackage | liboath-hs 0.0.1.2 - Bindings to liboath https://hackage.haskell.org/package/liboath-hs-0.0.1.2 (parsonsmatt) |
| 2020-10-26 14:35:25 | <merijn> | ixlun: You generate a lazy infinite list of random values :) |
| 2020-10-26 14:35:30 | <merijn> | > randoms (mkStdGen 5) |
| 2020-10-26 14:35:32 | <lambdabot> | [2287595555194033867,-7444196218550052205,7729549144295431816,-8651862829265... |
| 2020-10-26 14:35:44 | <merijn> | > randoms (mkStdGen 5) :: [Bool] |
| 2020-10-26 14:35:45 | <ixlun> | Ahhh I see |
| 2020-10-26 14:35:45 | <lambdabot> | [True,True,False,True,False,True,True,True,False,False,True,False,False,True... |
| 2020-10-26 14:36:55 | × | ryjm_matrix quits (~matrixirc@pool-74-105-197-68.nwrknj.fios.verizon.net) (Quit: killed) |
| 2020-10-26 14:36:56 | <ixlun> | Then I can just use zip to get the tuple array |
| 2020-10-26 14:37:13 | <ixlun> | (I need to learn to think lazily!) |
| 2020-10-26 14:37:41 | → | unlink_ joins (~unlink2@p57b8559c.dip0.t-ipconnect.de) |
| 2020-10-26 14:37:58 | × | unlink2 quits (~unlink2@p5b088fe0.dip0.t-ipconnect.de) (Ping timeout: 260 seconds) |
| 2020-10-26 14:39:05 | → | elfets joins (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de) |
| 2020-10-26 14:40:25 | × | idhugo_ quits (~idhugo@users-1190.st.net.au.dk) (Ping timeout: 240 seconds) |
| 2020-10-26 14:40:31 | <thblt> | Re monad transformers, does lift . lift already have a name? |
| 2020-10-26 14:41:56 | <[exa]> | thblt: I guess 'doubleLift' would be longer than 'lift.lift' |
| 2020-10-26 14:42:25 | <thblt> | I thought lift2, but undefined |
| 2020-10-26 14:42:41 | <[exa]> | thblt: anyway people often use typeclasses like MonadReader and MonadState that auto-lift the action to appropriate context |
| 2020-10-26 14:44:40 | <thblt> | Maybe I'm doing something stupid actually! I have `type Game = ReaderT GConf (StateT GState IO)`, so in `somefunc :: Game ()` I *think* I can only do IO by `lift . lift $ someIoFunction`. Am I wrong? |
| 2020-10-26 14:45:51 | × | unlink_ quits (~unlink2@p57b8559c.dip0.t-ipconnect.de) (Remote host closed the connection) |
| 2020-10-26 14:45:57 | <thblt> | Er, liftIO |
| 2020-10-26 14:47:12 | <thblt> | Who could have guessed this would be the name of the function to lift into IO? /s |
| 2020-10-26 14:47:23 | → | unlink2 joins (~unlink2@p200300ebcf180b00a39cfda93b79d512.dip0.t-ipconnect.de) |
| 2020-10-26 14:47:58 | → | Guest18 joins (567e8866@gateway/web/cgi-irc/kiwiirc.com/ip.86.126.136.102) |
| 2020-10-26 14:48:04 | → | sakirious joins (~sakirious@c-71-197-191-137.hsd1.wa.comcast.net) |
| 2020-10-26 14:48:18 | <[exa]> | :t liftIO |
| 2020-10-26 14:48:19 | <lambdabot> | MonadIO m => IO a -> m a |
| 2020-10-26 14:48:25 | <[exa]> | there it is, MonadIO |
| 2020-10-26 14:48:45 | <thblt> | [exa]: ]thanks |
| 2020-10-26 14:50:14 | → | wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) |
| 2020-10-26 14:50:22 | <ixlun> | If I want to index by a data type into an array, do people prefer using Enum and a Vector, or derving Ix and an Array? |
| 2020-10-26 14:50:44 | → | nados joins (~dan@69-165-210-185.cable.teksavvy.com) |
| 2020-10-26 14:50:51 | <opqdonut> | I think nobody uses the Array types any more... |
| 2020-10-26 14:51:01 | <dminuoso> | ixlun: or a map? |
| 2020-10-26 14:51:03 | <opqdonut> | at least for serious software |
| 2020-10-26 14:51:15 | <ixlun> | Why has Array died? |
| 2020-10-26 14:51:25 | × | esp32_prog quits (yoann@gateway/vpn/protonvpn/esp32prog/x-46565127) (Remote host closed the connection) |
| 2020-10-26 14:51:28 | <dminuoso> | Enum feels like a horrible kludge for most cases |
| 2020-10-26 14:51:32 | × | ericsagnes quits (~ericsagne@2405:6580:0:5100:5005:892f:e188:1072) (Ping timeout: 260 seconds) |
| 2020-10-26 14:51:39 | <dminuoso> | It's used incorrectly mostly |
| 2020-10-26 14:51:39 | <opqdonut> | I guess it didn't offer unboxed variants? that's at least one reason to prefer Vector |
| 2020-10-26 14:52:00 | <opqdonut> | also the Vector API is just a bit cleaner maybe? I don't know really |
| 2020-10-26 14:52:33 | <ixlun> | dminuoso: I hadn't thought about using a Map |
| 2020-10-26 14:52:45 | × | damianfral3 quits (~damianfra@25.red-176-87-152.dynamicip.rima-tde.net) (Ping timeout: 240 seconds) |
| 2020-10-26 14:52:46 | <opqdonut> | Maps tend to be nicer for updates |
| 2020-10-26 14:53:15 | <ixlun> | It's just static data, that I know is going to have a fixed size |
| 2020-10-26 14:53:33 | <ixlun> | seems a shame to incur the performace penalty for lookups when I could index straight to it |
| 2020-10-26 14:53:44 | <[exa]> | ixlun: if you can convert your data to 0..n, just go for the vector :] |
| 2020-10-26 14:53:52 | <dminuoso> | ixlun: Is that code region in a hotspot? |
| 2020-10-26 14:53:58 | <dminuoso> | or do you have your premature optimization hat on? |
| 2020-10-26 14:54:16 | → | bitmapper joins (uid464869@gateway/web/irccloud.com/x-nwqswzdnuoofdofv) |
| 2020-10-26 14:54:16 | <dminuoso> | If it's the latter, I'd just go for map.. |
| 2020-10-26 14:54:21 | <ixlun> | dminuoso: quite possi |
| 2020-10-26 14:54:22 | → | hnOsmium0001 joins (uid453710@gateway/web/irccloud.com/x-slcbmpdbycbqjlou) |
| 2020-10-26 14:54:30 | <ixlun> | possibly!* |
| 2020-10-26 14:55:01 | × | britva quits (~britva@31-10-157-156.cgn.dynamic.upc.ch) (Quit: This computer has gone to sleep) |
| 2020-10-26 14:55:43 | × | plutoniix quits (~q@ppp-27-55-83-145.revip3.asianet.co.th) (Quit: Leaving) |
| 2020-10-26 14:55:57 | <ixlun> | [exa]: I have managed to implement Enum for the data type, it's a union of two other types that also dervie Enums so I just shiftR one of the values |
| 2020-10-26 14:56:00 | × | kish quits (~oracle@unaffiliated/oracle) (Ping timeout: 258 seconds) |
| 2020-10-26 14:56:38 | <ixlun> | Err, `shiftL` sorry |
| 2020-10-26 14:58:28 | <dminuoso> | Is there a cute little high performance prettyprinter with low dependency footprint? |
| 2020-10-26 14:59:28 | <dminuoso> | prettyprinter sadly drags semigroups along with it :( |
| 2020-10-26 14:59:53 | → | damianfral3 joins (~damianfra@25.red-176-87-152.dynamicip.rima-tde.net) |
| 2020-10-26 15:00:01 | × | Eramdam1 quits (~Eramdam@195.140.213.38) () |
| 2020-10-26 15:02:59 | → | ericsagnes joins (~ericsagne@2405:6580:0:5100:29f6:82d:9503:e1) |
| 2020-10-26 15:03:08 | → | raehik joins (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) |
| 2020-10-26 15:03:14 | → | ddellacosta joins (~dd@86.106.121.168) |
| 2020-10-26 15:03:45 | <[exa]> | ixlun: so just wrap the (!) from Vector with your new fromEnum and there you have it :] |
| 2020-10-26 15:06:55 | <int-e> | dminuoso: is that really so bad? |
| 2020-10-26 15:08:42 | <tomsmeding> | opqdonut: https://hackage.haskell.org/package/array-0.5.4.0/docs/Data-Array-Unboxed.html ? |
| 2020-10-26 15:11:03 | <tomsmeding> | I like the fact that 'array' has 0 dependencies |
| 2020-10-26 15:12:56 | <[exa]> | dminuoso: I don't see any other reason for the semigroup dependency other than that they have NonEmpty list instance there... you might just kill it in a local repo copy, if the dependency is the only problem |
| 2020-10-26 15:14:11 | × | seanvert` quits (~user@177.84.244.242) (Remote host closed the connection) |
| 2020-10-26 15:14:31 | <tomsmeding> | that's an annoying situation in general, I think I've seen stuff pull in aeson just to provide a FromJSON instance or something |
| 2020-10-26 15:14:38 | → | seanvert` joins (~user@177.84.244.242) |
| 2020-10-26 15:15:14 | <dminuoso> | [exa], int-e: semigroups pulls in quite a bunch of libraries |
| 2020-10-26 15:17:05 | <dminuoso> | At any rate |
| 2020-10-26 15:17:07 | <dminuoso> | https://hackage.haskell.org/package/pretty |
| 2020-10-26 15:17:10 | <dminuoso> | This looks about right |
| 2020-10-26 15:17:34 | <dminuoso> | deepseq is already in my dependency footprint, so this is very very light :) |
| 2020-10-26 15:19:11 | <[exa]> | I'm using this one on tutorials, it's been around forever. It's pretty simple so I didn't expect it would be very fast |
| 2020-10-26 15:20:54 | → | TooDifficult joins (~TooDiffic@139.59.59.230) |
| 2020-10-26 15:21:18 | × | toorevitimirp quits (~tooreviti@117.182.180.36) (Remote host closed the connection) |
| 2020-10-26 15:22:32 | <tomsmeding> | it seems 'pretty' doesn't have an equivalent of https://hackage.haskell.org/package/prettyprinter-1.7.0/docs/Prettyprinter.html#v:flatAlt , does it? |
| 2020-10-26 15:23:14 | <tomsmeding> | if that's true, that alone should make it O(input + output), which is already pretty fast |
| 2020-10-26 15:24:48 | → | DataComputist joins (~lumeng@static-50-43-26-251.bvtn.or.frontiernet.net) |
| 2020-10-26 15:25:15 | → | thir joins (~thir@p200300f27f0b7e004c18ab60065ea01b.dip0.t-ipconnect.de) |
| 2020-10-26 15:26:15 | <int-e> | dminuoso: you could play with the flags... |
| 2020-10-26 15:26:41 | <tomsmeding> | oh right it does have 'sep' and friends, which do alternatives, so it'll be slow too |
| 2020-10-26 15:28:47 | <thblt> | For the lazy, is there an automated way to reduce imports to what's strictly required by the module? Ie to turn `import Module` into `import Module (used, or, reexported, names)`? |
| 2020-10-26 15:29:42 | × | thir quits (~thir@p200300f27f0b7e004c18ab60065ea01b.dip0.t-ipconnect.de) (Ping timeout: 260 seconds) |
| 2020-10-26 15:29:44 | → | heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) |
| 2020-10-26 15:31:36 | <tomsmeding> | thblt: I don't think there's a tool to do that, but there is also no unique answer |
| 2020-10-26 15:31:59 | <tomsmeding> | what if A and B both export 'foo', and you use 'foo' in a module that has 'import A' 'import B' |
| 2020-10-26 15:32:07 | → | geowiesnot joins (~user@i15-les02-ix2-87-89-181-157.sfr.lns.abo.bbox.fr) |
| 2020-10-26 15:32:10 | <tomsmeding> | should the tool add (foo) to A or to B? |
All times are in UTC.