Logs: freenode/#haskell
| 2021-03-08 21:47:22 | → | wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) |
| 2021-03-08 21:49:02 | → | rj joins (~x@gateway/tor-sasl/rj) |
| 2021-03-08 21:49:46 | → | notzmv joins (~zmv@unaffiliated/zmv) |
| 2021-03-08 21:51:02 | × | augnun quits (~augnun@2804:14c:658b:41bb:ef4f:8ed7:91aa:3226) (Ping timeout: 264 seconds) |
| 2021-03-08 21:51:02 | × | alx741 quits (~alx741@186.178.108.142) (Ping timeout: 264 seconds) |
| 2021-03-08 21:52:17 | → | roconnor joins (~roconnor@host-45-58-192-182.dyn.295.ca) |
| 2021-03-08 21:52:24 | × | wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 260 seconds) |
| 2021-03-08 21:52:54 | × | ADG1089__ quits (~aditya@223.226.235.12) (Remote host closed the connection) |
| 2021-03-08 21:53:59 | fendor__ | is now known as fendor |
| 2021-03-08 21:55:38 | <monochrom> | Yes, GHC is pretty happy to eliminate duplicate pattern matching, e.g., https://mail.haskell.org/pipermail/haskell-cafe/2013-April/107775.html |
| 2021-03-08 21:56:40 | <monochrom> | But also pretty reluctant in general CSE. |
| 2021-03-08 21:57:10 | <dolio> | Yeah, you need to be doing something at least a little weird. |
| 2021-03-08 21:58:06 | <dolio> | I wouldn't be surprised if most CSE it does isn't something the programmer writes, but caused by optimizations. |
| 2021-03-08 21:58:33 | <dolio> | Like inlining of those test-and-project definitions. |
| 2021-03-08 21:58:39 | × | dddddd quits (~dddddd@unaffiliated/dddddd) (Ping timeout: 256 seconds) |
| 2021-03-08 21:58:44 | <monochrom> | SPJ's Core talk has a lot about details of optimizing pattern matching in the 2nd half. https://youtu.be/uR_VzYxvbxg |
| 2021-03-08 22:00:18 | → | dddddd joins (~dddddd@unaffiliated/dddddd) |
| 2021-03-08 22:01:03 | × | dunj3 quits (~dunj3@2001:16b8:305c:2000:1ee1:f93:679:daad) (Remote host closed the connection) |
| 2021-03-08 22:01:28 | → | conal joins (~conal@192.145.118.133) |
| 2021-03-08 22:02:21 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 264 seconds) |
| 2021-03-08 22:02:32 | <dolio> | Also, if you think about it, that corresponds considerably more closely to what CSE would do in an eager language. You CSE because you're pre-evaluating the same thing twice in a scope before continuing. |
| 2021-03-08 22:02:57 | <dolio> | Not just naming the same expression twice. |
| 2021-03-08 22:03:07 | <monochrom> | Yeah, that's a good perspective. |
| 2021-03-08 22:04:23 | <monochrom> | Whereas CSE on lazy expressions can cost more space than worthwhile. |
| 2021-03-08 22:04:41 | × | nbloomf quits (~nbloomf@2600:1700:ad14:3020:11c5:786:f774:d85e) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2021-03-08 22:04:46 | → | nineonin_ joins (~nineonine@50.216.62.2) |
| 2021-03-08 22:05:12 | → | alx741 joins (~alx741@186.178.108.96) |
| 2021-03-08 22:06:49 | <monochrom> | Very nice way to look at it. Thanks dolio. |
| 2021-03-08 22:08:26 | × | nineonine quits (~nineonine@2604:3d08:7785:9600:d8fe:8116:376f:ddd2) (Ping timeout: 264 seconds) |
| 2021-03-08 22:08:35 | <dolio> | I guess you could still run into issues because of deeper laziness, but you'd have to be doing something a bit odd. |
| 2021-03-08 22:09:10 | <evrgreen> | Is it possible to `instance Data.Aeson.ToJSON (Data.Array.Array Int Int)`? I get `No instance for (Generic (Data.Array.Array Int Int)) ...` |
| 2021-03-08 22:10:05 | → | heatsink joins (~heatsink@2600:1700:bef1:5e10:246b:c0a0:2c4b:51c3) |
| 2021-03-08 22:10:20 | <evrgreen> | Hoping to do derive it automatically rather than writing my ToJSON. |
| 2021-03-08 22:10:31 | <monochrom> | Do you mind using Vector instead of Array? I think aeson has done Vector. |
| 2021-03-08 22:11:59 | <heck-to-the-gnom> | if I have a type synonym of `ex = Int -> Int` is it possible to do something like `xyz :: ex -> Int` where that would really be `xyz :: Int -> Int -> Int` instead of `(Int -> Int) -> Int`? |
| 2021-03-08 22:12:53 | <monochrom> | I think "type ex = Int->Int" is a syntax error. Need to capitalize "ex". type Ex = Int->Int |
| 2021-03-08 22:12:56 | × | jluttine quits (~jluttine@85-23-95-149.bb.dnainternet.fi) (Ping timeout: 240 seconds) |
| 2021-03-08 22:13:37 | <heck-to-the-gnom> | OK, that was pseudo Haskell, but what about my question? |
| 2021-03-08 22:13:39 | <monochrom> | Ex->Int will always mean (Int->Int)->Int. This is syntax tree substitution not textual substitution. |
| 2021-03-08 22:13:56 | <heck-to-the-gnom> | but... Is there a way to do that? |
| 2021-03-08 22:14:04 | <monochrom> | #define? |
| 2021-03-08 22:14:08 | <heck-to-the-gnom> | aside from a makefile script that changes occurrences or something |
| 2021-03-08 22:14:40 | <heck-to-the-gnom> | You can do that in Haskell? |
| 2021-03-08 22:15:13 | <monochrom> | Normally we use C preprocesor stuff for conditional compilation. But yes that means you have full access to #define tricks. |
| 2021-03-08 22:15:48 | <monochrom> | and you add {-# language CPP #-} |
| 2021-03-08 22:16:04 | <monochrom> | It's a total kludge, yes. |
| 2021-03-08 22:16:30 | <monochrom> | The "alternative" is Template Haskell which is way more complex for this use case, but more disciplined. |
| 2021-03-08 22:16:46 | <monochrom> | But my real opinion is "just don't do it". |
| 2021-03-08 22:17:06 | × | jb55 quits (~jb55@gateway/tor-sasl/jb55) (Quit: jb55) |
| 2021-03-08 22:17:09 | × | dhouthoo quits (~dhouthoo@ptr-eitgbj2w0uu6delkbrh.18120a2.ip6.access.telenet.be) (Quit: WeeChat 3.0) |
| 2021-03-08 22:17:19 | <heck-to-the-gnom> | I just have a decent number of types that have a lot in common, and I'm trying to make it easier to understand |
| 2021-03-08 22:17:56 | <monochrom> | Perhaps look for another commanlity. |
| 2021-03-08 22:18:19 | <evrgreen> | I oversimplified my example; the index is really a tuple (a 2D coordinate). But I see one can do multidimensional vectors, so I'll try that... https://wiki.haskell.org/Numeric_Haskell:_A_Vector_Tutorial#Simple_example |
| 2021-03-08 22:18:20 | → | jb55 joins (~jb55@gateway/tor-sasl/jb55) |
| 2021-03-08 22:19:26 | <monochrom> | Yeah evrgreen, I was going to say that a compromise is you still write your own ToJSON instance but you just convert to Vector then toJSON the Vector. |
| 2021-03-08 22:20:08 | <evrgreen> | Oh, yes. Much better than changing my core data type. |
| 2021-03-08 22:21:02 | × | Varis quits (~Tadas@unaffiliated/varis) (Remote host closed the connection) |
| 2021-03-08 22:21:37 | → | howdoi joins (uid224@gateway/web/irccloud.com/x-pnwfbntchtcoqxxp) |
| 2021-03-08 22:21:42 | <monochrom> | The fundamental issue IMO is that JSON itself doesn't have any notion of "array but the index range is not 0..n-1" in the first place. |
| 2021-03-08 22:22:20 | → | Varis joins (~Tadas@unaffiliated/varis) |
| 2021-03-08 22:22:59 | × | conal quits (~conal@192.145.118.133) (Ping timeout: 245 seconds) |
| 2021-03-08 22:23:19 | <heck-to-the-gnom> | Another question, I've copied code from another module, and this module has a public method, but even though all the imports are there, and are similitude when I use it (in the same way) within the copied code it gives me a variable not in scope error. What's up here? |
| 2021-03-08 22:23:26 | → | jluttine joins (~jluttine@85-23-95-149.bb.dnainternet.fi) |
| 2021-03-08 22:25:53 | × | fendor quits (~fendor@178.115.130.180.wireless.dyn.drei.com) (Remote host closed the connection) |
| 2021-03-08 22:27:05 | × | Cale quits (~cale@cpef48e38ee8583-cm0c473de9d680.cpe.net.cable.rogers.com) (Remote host closed the connection) |
| 2021-03-08 22:27:05 | → | conal joins (~conal@64.71.133.70) |
| 2021-03-08 22:28:03 | × | gehmehgeh quits (~ircuser1@gateway/tor-sasl/gehmehgeh) (Quit: Leaving) |
| 2021-03-08 22:28:23 | → | frozenErebus joins (~frozenEre@94.128.82.20) |
| 2021-03-08 22:29:00 | × | rj quits (~x@gateway/tor-sasl/rj) (Ping timeout: 268 seconds) |
| 2021-03-08 22:29:38 | → | ystael joins (~ystael@209.6.50.55) |
| 2021-03-08 22:30:31 | × | mirrorbird quits (dwsjeid911@gateway/vpn/mullvad/dwsjeid911) (Ping timeout: 276 seconds) |
| 2021-03-08 22:30:51 | × | Franciman quits (~francesco@host-82-49-79-189.retail.telecomitalia.it) (Quit: Leaving) |
| 2021-03-08 22:31:36 | → | rj joins (~x@gateway/tor-sasl/rj) |
| 2021-03-08 22:31:40 | → | raehik joins (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) |
| 2021-03-08 22:32:09 | × | redmp quits (~redmp@172.58.38.215) (Ping timeout: 256 seconds) |
| 2021-03-08 22:32:59 | → | ddellacosta joins (ddellacost@gateway/vpn/mullvad/ddellacosta) |
| 2021-03-08 22:34:30 | → | mirrorbird joins (dwsjeid911@gateway/vpn/mullvad/dwsjeid911) |
| 2021-03-08 22:36:15 | <lyxia> | heck-to-the-gnom: you did not rename correctly, or not all of the imports are actually there, for example if the code depends on other unexported definitions in that other module. |
| 2021-03-08 22:38:49 | × | mirrorbird quits (dwsjeid911@gateway/vpn/mullvad/dwsjeid911) (Ping timeout: 245 seconds) |
| 2021-03-08 22:38:57 | × | olligobber quits (olligobber@gateway/vpn/privateinternetaccess/olligobber) (Ping timeout: 264 seconds) |
| 2021-03-08 22:39:16 | × | conal quits (~conal@64.71.133.70) (Quit: Computer has gone to sleep.) |
| 2021-03-08 22:39:48 | → | pfurla_ joins (~pfurla@ool-182ed2e2.dyn.optonline.net) |
| 2021-03-08 22:40:53 | × | pfurla quits (~pfurla@ool-182ed2e2.dyn.optonline.net) (Ping timeout: 245 seconds) |
| 2021-03-08 22:48:51 | × | stree quits (~stree@68.36.8.116) (Ping timeout: 246 seconds) |
| 2021-03-08 22:48:59 | × | Varis quits (~Tadas@unaffiliated/varis) (Quit: Leaving) |
| 2021-03-08 22:49:33 | × | heatsink quits (~heatsink@2600:1700:bef1:5e10:246b:c0a0:2c4b:51c3) (Remote host closed the connection) |
| 2021-03-08 22:49:38 | × | deviantfero quits (~deviantfe@190.150.27.58) (Quit: WeeChat 3.0.1) |
| 2021-03-08 22:49:59 | → | deviantfero joins (~deviantfe@190.150.27.58) |
| 2021-03-08 22:50:26 | × | deviantfero quits (~deviantfe@190.150.27.58) (Client Quit) |
| 2021-03-08 22:51:39 | → | JokerAscensionEx joins (~egp_@2.95.74.168) |
| 2021-03-08 22:52:11 | <arahael> | monochrom: At a pinch, you could use an object where the keys are your non-zero-based array indexes. |
| 2021-03-08 22:54:14 | <Axman6> | heck-to-the-gnom: type Ex a = Int -> Int -> a? xyz :: Ex Int -- a.k.a Int -> Int -> Int |
| 2021-03-08 22:54:39 | <ephemient> | not exactly legal JSON, but in JS [, 1, 2, 3] is allowed... that's an array with the first (valid) index at 1, sorta :D |
| 2021-03-08 22:54:43 | × | mayleesia quits (4e37fceb@dynamic-078-055-252-235.78.55.pool.telefonica.de) (Quit: Connection closed) |
| 2021-03-08 22:55:53 | → | cookielady joins (5f5ebd5c@a95-94-189-92.cpe.netcabo.pt) |
| 2021-03-08 22:56:06 | <monochrom> | yikes |
| 2021-03-08 22:56:41 | → | conal joins (~conal@64.71.133.70) |
| 2021-03-08 22:56:55 | → | deviantfero joins (~deviantfe@190.150.27.58) |
| 2021-03-08 22:57:41 | × | danvet quits (~Daniel@2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa) (Ping timeout: 272 seconds) |
| 2021-03-08 22:59:09 | <__minoru__shirae> | there is word for that thing in js, like "non-continuous indices" or something |
All times are in UTC.