Logs: liberachat/#haskell
| 2021-07-15 17:57:59 | <boxscape> | welcome |
| 2021-07-15 17:58:53 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-07-15 17:59:04 | <flareon> | boxscape: as a user, to be on the safe side, i should treat `Foo.Bar` and `Foo.Bar.Baz.Quux` as entirely different module with no relation to one another. right? |
| 2021-07-15 17:59:11 | <tomsmeding> | for what it's worth, I believe python works the same way |
| 2021-07-15 17:59:31 | <flareon> | tomsmeding: i see. |
| 2021-07-15 17:59:42 | <tomsmeding> | flareon: no relation a priori, unless the docs of that particular module say otherwise :) |
| 2021-07-15 18:00:19 | <boxscape> | flareon: yep, as tomsmeding said ideally look at the docs of Foo.Bar and if it has a line "module Foo.Bar.Baz.Quux" somewhere you know it reexports it |
| 2021-07-15 18:00:21 | → | eggplantade joins (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
| 2021-07-15 18:00:43 | <boxscape> | for example: https://hackage.haskell.org/package/containers-0.6.5.1/docs/Data-Map.html |
| 2021-07-15 18:00:51 | → | zeenk joins (~zeenk@2a02:2f04:a106:9600:82fb:aed9:ca9:38d3) |
| 2021-07-15 18:00:52 | → | chris_ joins (~chris@81.96.113.213) |
| 2021-07-15 18:00:54 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-07-15 18:00:56 | <boxscape> | says "module Data.Map.Lazy" as first "declaration" |
| 2021-07-15 18:02:03 | → | wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) |
| 2021-07-15 18:03:48 | × | ukari quits (~ukari@user/ukari) (Remote host closed the connection) |
| 2021-07-15 18:04:11 | <lechner> | Hi, do people here generally agree that standard modules should be qualified imports? Thanks! https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md#imports |
| 2021-07-15 18:04:31 | <maerwald> | no one here agrees on anything |
| 2021-07-15 18:04:36 | <Rembane> | +1 |
| 2021-07-15 18:04:55 | → | ukari joins (~ukari@user/ukari) |
| 2021-07-15 18:05:08 | → | cfricke joins (~cfricke@user/cfricke) |
| 2021-07-15 18:05:12 | <boxscape> | lechner: note that the style guide doesn't say that - it says "use explicit import lists *or* qualified imports" |
| 2021-07-15 18:05:13 | <tomsmeding> | why does that same guide in the very next codeblock use Socket and ByteString unqualified |
| 2021-07-15 18:05:24 | <tomsmeding> | ah right |
| 2021-07-15 18:05:44 | × | lavaman quits (~lavaman@98.38.249.169) (Ping timeout: 265 seconds) |
| 2021-07-15 18:05:47 | <lechner> | i see |
| 2021-07-15 18:06:09 | → | pesada joins (~agua@2804:18:43:3e21:1:0:20af:708a) |
| 2021-07-15 18:06:21 | <tomsmeding> | but what maerwald says :p |
| 2021-07-15 18:06:23 | × | agua quits (~agua@2804:14c:8793:8e2f:99df:d2fc:1544:f08e) (Read error: Connection reset by peer) |
| 2021-07-15 18:06:25 | <boxscape> | lechner: generally speaking people will use qualified imports for modules that define a lot of functions with the same name as functions in the Prelude, like a lot of the containers modules (Data.Map etc.) |
| 2021-07-15 18:06:28 | × | Topsi quits (~Tobias@dyndsl-095-033-090-054.ewe-ip-backbone.de) (Read error: Connection reset by peer) |
| 2021-07-15 18:06:42 | → | agua joins (~agua@2804:14c:8793:8e2f:99df:d2fc:1544:f08e) |
| 2021-07-15 18:06:51 | × | pesada quits (~agua@2804:18:43:3e21:1:0:20af:708a) (Read error: Connection reset by peer) |
| 2021-07-15 18:06:55 | × | prite quits (~pritam@user/pritambaral) (Ping timeout: 246 seconds) |
| 2021-07-15 18:07:01 | → | pesada joins (~agua@2804:18:43:3e21:1:0:20af:708a) |
| 2021-07-15 18:07:11 | × | wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 265 seconds) |
| 2021-07-15 18:07:28 | <boxscape> | (I don't mean to imply with that that people don't use qualified imports for other modules, but it's much less universal for other modules) |
| 2021-07-15 18:07:42 | <lechner> | i actually like the idea but what are good short names? Things like BL are too cryptic for me |
| 2021-07-15 18:07:45 | → | prite joins (~pritam@user/pritambaral) |
| 2021-07-15 18:07:45 | × | flareon quits (~flareon@117.222.66.126) (Quit: leaving) |
| 2021-07-15 18:08:16 | <maerwald> | I use my cats names |
| 2021-07-15 18:08:18 | <tomsmeding> | for certain things like bytestrings, Data.Text, Data.Map, people use fairly standard shortened names |
| 2021-07-15 18:08:25 | <boxscape> | lechner: how about BS.Lazy |
| 2021-07-15 18:09:17 | <boxscape> | maerwald: I can only imagine that working well if you named your cats after Haskell modules |
| 2021-07-15 18:09:27 | <maerwald> | of course I did |
| 2021-07-15 18:10:08 | <maerwald> | CatString.Lazy |
| 2021-07-15 18:10:27 | <boxscape> | nice |
| 2021-07-15 18:10:35 | <boxscape> | lechner: here's a somewhat interesting example import list from the ghc codebase to give you an idea https://downloads.haskell.org/~ghc/9.0.1-alpha1/docs/html/libraries/ghc-boot-9.0.0.20200925/src/GHC-Unit-Database.html |
| 2021-07-15 18:10:37 | → | flareon joins (~flareon@117.222.66.126) |
| 2021-07-15 18:10:49 | <boxscape> | note also how they imported both Foldable and Traversable as the same name |
| 2021-07-15 18:10:57 | × | favonia quits (~favonia@user/favonia) (Ping timeout: 255 seconds) |
| 2021-07-15 18:10:57 | × | agua quits (~agua@2804:14c:8793:8e2f:99df:d2fc:1544:f08e) (Ping timeout: 245 seconds) |
| 2021-07-15 18:11:39 | × | silverwhitefish quits (~hidden@47.202.102.10) (Quit: One for all, all for One (2 Corinthians 5)) |
| 2021-07-15 18:12:07 | → | silverwhitefish joins (~hidden@47.202.102.10) |
| 2021-07-15 18:12:48 | ← | zyklotomic parts (~ethan@2604:a880:800:10::79f:8001) (WeeChat 2.8) |
| 2021-07-15 18:12:52 | × | elf_fortrez quits (~elf_fortr@adsl-72-50-4-188.prtc.net) (Ping timeout: 246 seconds) |
| 2021-07-15 18:14:21 | → | roboto_el_gato joins (~roboto_el@2600:1700:7df0:4f30:60ad:415d:9afc:74f1) |
| 2021-07-15 18:14:36 | × | mc47 quits (~mc47@xmonad/TheMC47) (Remote host closed the connection) |
| 2021-07-15 18:14:58 | → | mc47 joins (~mc47@xmonad/TheMC47) |
| 2021-07-15 18:17:45 | → | fresheyeball joins (~fresheyeb@c-71-237-105-37.hsd1.co.comcast.net) |
| 2021-07-15 18:17:45 | × | azeem quits (~azeem@dynamic-adsl-84-220-239-177.clienti.tiscali.it) (Read error: Connection reset by peer) |
| 2021-07-15 18:18:28 | → | azeem joins (~azeem@dynamic-adsl-84-220-239-177.clienti.tiscali.it) |
| 2021-07-15 18:20:43 | → | gzj joins (~GZJ0X@199.193.127.138.16clouds.com) |
| 2021-07-15 18:20:57 | → | themc47 joins (~mc47@xmonad/TheMC47) |
| 2021-07-15 18:21:16 | × | roboto_el_gato quits (~roboto_el@2600:1700:7df0:4f30:60ad:415d:9afc:74f1) (Ping timeout: 246 seconds) |
| 2021-07-15 18:23:32 | → | favonia joins (~favonia@user/favonia) |
| 2021-07-15 18:23:39 | × | mc47 quits (~mc47@xmonad/TheMC47) (Ping timeout: 258 seconds) |
| 2021-07-15 18:25:22 | → | zebrag joins (~chris@user/zebrag) |
| 2021-07-15 18:27:00 | × | MQ-17J quits (~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Ping timeout: 265 seconds) |
| 2021-07-15 18:27:53 | → | michalz joins (~michalz@185.246.204.50) |
| 2021-07-15 18:29:14 | → | roboto_el_gato joins (~roboto_el@2600:1700:7df0:4f30:60ad:415d:9afc:74f1) |
| 2021-07-15 18:29:32 | <lechner> | Hi, how can I import 'Rep' from System.ZMQ4.Monadic, please? |
| 2021-07-15 18:31:23 | → | MQ-17J joins (~MQ-17J@d14-69-206-129.try.wideopenwest.com) |
| 2021-07-15 18:31:58 | → | jlamothe joins (~jlamothe@198.251.60.157) |
| 2021-07-15 18:32:48 | <flareon> | boxscape: i checked and it looks like all the exports of `Data.Map` are actually exports of `Data.Map.Lazy` which are done through exporting `Data.Map.Lazy` from `Data.Map`, similarly `Text.Parsec` exports `Text.Parsec.Char` from itself. but they do mention it in the documentation and corresponding source. thanks! |
| 2021-07-15 18:32:51 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 258 seconds) |
| 2021-07-15 18:33:47 | × | norias quits (~jaredm@c-98-219-195-163.hsd1.pa.comcast.net) (Quit: Leaving) |
| 2021-07-15 18:35:58 | <flareon> | boxscape: but since neither `Data.Map.Lazy` nor `Text.Parsec.Char` are exported qualified one can access their functions directly from importing `Data.Map` and `Text.Parsec`. that and mindlessly checking imports through tab completion in the repl with `Prelude` imported led to my confusion. |
| 2021-07-15 18:36:28 | <boxscape> | yeah, that's understandable |
| 2021-07-15 18:37:15 | <boxscape> | (btw, you can only import qualified, not export qualified, though I believe there are some proposals around to allow something like that) |
| 2021-07-15 18:40:31 | × | roboto_el_gato quits (~roboto_el@2600:1700:7df0:4f30:60ad:415d:9afc:74f1) (Ping timeout: 246 seconds) |
| 2021-07-15 18:44:12 | × | azeem quits (~azeem@dynamic-adsl-84-220-239-177.clienti.tiscali.it) (Read error: Connection reset by peer) |
| 2021-07-15 18:44:37 | × | eggplantade quits (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
| 2021-07-15 18:44:51 | <flareon> | boxscape: i see. |
| 2021-07-15 18:45:04 | → | machinedgod joins (~machinedg@24.105.81.50) |
| 2021-07-15 18:46:21 | → | azeem joins (~azeem@dynamic-adsl-84-220-239-177.clienti.tiscali.it) |
| 2021-07-15 18:47:36 | → | dhouthoo joins (~dhouthoo@178-117-36-167.access.telenet.be) |
| 2021-07-15 18:47:40 | <lechner> | Hi, in order to avoid overlaps with accessors (which are in the global name space) I place JSON definitions in dedicated files named after the type, but referencing the type then results in repetition, as in Task.Task. Is there another way? |
| 2021-07-15 18:47:47 | × | flareon quits (~flareon@117.222.66.126) (Quit: leaving) |
| 2021-07-15 18:48:38 | <boxscape> | lechner: have one qualified import statement for the functions in the module and one just importing the type, as in `import Foo.Bar.Task (Task(..))` |
| 2021-07-15 18:48:54 | <boxscape> | in addition to `import qualified Foo.Bar.Task as Task` |
| 2021-07-15 18:49:03 | <boxscape> | (afk) |
| 2021-07-15 18:50:58 | <boxscape> | or the first one should probably be `import Foo.Bar.Task (Task)` if you don't want to import the constructors unqualified |
| 2021-07-15 18:51:26 | → | Obo joins (~roberto@70.pool90-171-81.dynamic.orange.es) |
| 2021-07-15 18:55:00 | × | themc47 quits (~mc47@xmonad/TheMC47) (Ping timeout: 252 seconds) |
| 2021-07-15 18:56:24 | × | drd quits (~drd@93-39-151-19.ip76.fastwebnet.it) (Quit: ZNC 1.8.2 - https://znc.in) |
| 2021-07-15 18:56:41 | <tomsmeding> | yeah, 'import qualified Data.Map.Strict as Map; import Data.Map.Strict (Map)' is quite a common pattern |
| 2021-07-15 19:02:40 | × | dhouthoo quits (~dhouthoo@178-117-36-167.access.telenet.be) (Quit: WeeChat 3.2) |
| 2021-07-15 19:02:52 | <dminuoso> | {-# LANGUAGE UnqualifiedTypeConstructors #-} could be a thing! |
| 2021-07-15 19:03:25 | <[exa]> | lechner: it's also a quite common practice to name the accessors prefixed with the type; such as `taskName` and `taskType` etc |
| 2021-07-15 19:03:33 | <dminuoso> | That language extension would do a very minimal thing and expose all qualified type constructors as unqualified too. |
All times are in UTC.