Logs: freenode/#haskell
| 2021-05-02 09:24:06 | × | thevishy quits (~Nishant@117.193.35.68) (Client Quit) |
| 2021-05-02 09:24:25 | × | Sgeo_ quits (~Sgeo@ool-18b9875e.dyn.optonline.net) (Read error: Connection reset by peer) |
| 2021-05-02 09:26:53 | → | Sgeo joins (~Sgeo@ool-18b9875e.dyn.optonline.net) |
| 2021-05-02 09:31:26 | → | geowiesnot joins (~user@87-89-181-157.abo.bbox.fr) |
| 2021-05-02 09:32:40 | → | v01d4lph4 joins (~v01d4lph4@171.48.62.25) |
| 2021-05-02 09:32:43 | × | puffnfresh1 quits (~puffnfres@119-17-138-164.77118a.mel.static.aussiebb.net) (Ping timeout: 252 seconds) |
| 2021-05-02 09:33:05 | × | heatsink quits (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
| 2021-05-02 09:33:06 | → | locallycompact joins (~quassel@163.172.189.45) |
| 2021-05-02 09:33:18 | → | biglama joins (~alex@static-176-165-167-17.ftth.abo.bbox.fr) |
| 2021-05-02 09:33:28 | → | puffnfresh1 joins (~puffnfres@119-17-138-164.77118a.mel.static.aussiebb.net) |
| 2021-05-02 09:35:07 | × | Sgeo quits (~Sgeo@ool-18b9875e.dyn.optonline.net) (Read error: Connection reset by peer) |
| 2021-05-02 09:40:11 | × | geowiesnot quits (~user@87-89-181-157.abo.bbox.fr) (Ping timeout: 240 seconds) |
| 2021-05-02 09:41:34 | → | __monty__ joins (~toonn@unaffiliated/toonn) |
| 2021-05-02 09:41:44 | × | st8less quits (~st8less@inet-167-224-197-181.isp.ozarksgo.net) (Quit: WeeChat 2.9) |
| 2021-05-02 09:45:32 | → | Neuromancer joins (~Neuromanc@unaffiliated/neuromancer) |
| 2021-05-02 09:46:15 | × | Guest96063 quits (~zmv@unaffiliated/zmv) (Remote host closed the connection) |
| 2021-05-02 09:47:18 | → | notzmv- joins (~zmv@unaffiliated/zmv) |
| 2021-05-02 09:48:45 | × | gehmehgeh quits (~ircuser1@gateway/tor-sasl/gehmehgeh) (Ping timeout: 240 seconds) |
| 2021-05-02 09:51:51 | → | gehmehgeh joins (~ircuser1@gateway/tor-sasl/gehmehgeh) |
| 2021-05-02 09:52:33 | → | Bigcheese joins (~quassel@unaffiliated/bigcheese) |
| 2021-05-02 09:54:23 | <nut> | if i name my file file.hsc, will it be automatically processed by the hsc2hs program? |
| 2021-05-02 09:54:49 | <nut> | in the cabal project |
| 2021-05-02 09:57:08 | → | todda7 joins (~torstein@2a02:587:3724:1a75:aca:df22:9d82:969f) |
| 2021-05-02 09:57:23 | → | ddellacosta joins (~ddellacos@86.106.143.100) |
| 2021-05-02 09:58:22 | → | DTZUZU_ joins (~DTZUZO@207.81.119.43) |
| 2021-05-02 09:58:46 | × | puffnfresh1 quits (~puffnfres@119-17-138-164.77118a.mel.static.aussiebb.net) (Ping timeout: 240 seconds) |
| 2021-05-02 09:59:27 | × | wei2912 quits (~wei2912@unaffiliated/wei2912) (Remote host closed the connection) |
| 2021-05-02 09:59:39 | × | DTZUZU quits (~DTZUZO@205.ip-149-56-132.net) (Ping timeout: 252 seconds) |
| 2021-05-02 10:00:36 | → | Rudd0 joins (~Rudd0@185.189.115.103) |
| 2021-05-02 10:01:52 | × | ddellacosta quits (~ddellacos@86.106.143.100) (Ping timeout: 265 seconds) |
| 2021-05-02 10:02:02 | <biglama> | Hi guys, I have a list of strings representing categories and subcategories, like this "flower", "rose", "dandelion", "food", "banana", "apple" ... I would like to convert it to a nested structure, for example : [("flower", ["rose", "dandelion"]), ("food", ["banana", "apple"])]... |
| 2021-05-02 10:02:19 | <biglama> | Is Data.Map most suited for that ? |
| 2021-05-02 10:03:09 | <biglama> | (there are subsubsub categories too) |
| 2021-05-02 10:04:38 | → | oish joins (~charlie@228.25.169.217.in-addr.arpa) |
| 2021-05-02 10:05:33 | <locallycompact> | that structure is a Map String [String] without subsubsubcategories |
| 2021-05-02 10:06:02 | <locallycompact> | you can do this indefinitely to a fixed length e.g (Map String (Map String [String])), but all the entries would have to be the same depth |
| 2021-05-02 10:07:49 | → | puffnfresh1 joins (~puffnfres@119-17-138-164.77118a.mel.static.aussiebb.net) |
| 2021-05-02 10:08:02 | <locallycompact> | if you want more freely structured trees then I tend to use Cofree [] which gives you arbitrary nesting depth |
| 2021-05-02 10:09:32 | <locallycompact> | I think that's also called a rosetree |
| 2021-05-02 10:10:18 | <biglama> | locallycompact: thanks ! I thought about using custom data types but, as I was typing the question, it was obvious a map was a better choice :D |
| 2021-05-02 10:11:03 | × | todda7 quits (~torstein@2a02:587:3724:1a75:aca:df22:9d82:969f) (Remote host closed the connection) |
| 2021-05-02 10:11:16 | → | juuandyy joins (~juuandyy@90.106.228.121) |
| 2021-05-02 10:11:52 | <biglama> | locallycompact: the documentation of cfree is not super clear for me :/ |
| 2021-05-02 10:13:27 | × | lawid quits (~quassel@2a02:8109:b5c0:5334:265e:beff:fe2a:dde8) (Read error: Connection reset by peer) |
| 2021-05-02 10:14:18 | <locallycompact> | Yeah cofree is very highly parameterised |
| 2021-05-02 10:14:28 | <locallycompact> | if you let f = [] in the definition then your example would be |
| 2021-05-02 10:15:29 | → | lawid joins (~quassel@ip5f5ae8d7.dynamic.kabel-deutschland.de) |
| 2021-05-02 10:15:35 | <locallycompact> | actually sorry it wouldn't be that exactly because it would be a list at the top level |
| 2021-05-02 10:15:52 | × | puffnfresh1 quits (~puffnfres@119-17-138-164.77118a.mel.static.aussiebb.net) (Ping timeout: 240 seconds) |
| 2021-05-02 10:16:12 | <biglama> | Maybe a custom nested structure would be best ? I think a tree should do the job |
| 2021-05-02 10:16:14 | <locallycompact> | ["flower" :< ["dandelion" :< [], "rose" :< []], "food" :< ["banana" :< [], "apple" :< []]] :: [Cofree [] String] |
| 2021-05-02 10:16:18 | → | puffnfresh1 joins (~puffnfres@119-17-138-164.77118a.mel.static.aussiebb.net) |
| 2021-05-02 10:17:35 | <locallycompact> | depends on the use case really |
| 2021-05-02 10:18:11 | × | p3n_ quits (~p3n@2a00:19a0:3:7c:0:d9c6:7cf6:1) (Remote host closed the connection) |
| 2021-05-02 10:18:37 | <biglama> | How would you parse the tree ? I just want to pretty-print it as it comes as a list of string |
| 2021-05-02 10:18:49 | × | nut quits (~gtk@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) (Ping timeout: 260 seconds) |
| 2021-05-02 10:19:21 | <locallycompact> | if it's coming in as an unstructured list that sound quite involved |
| 2021-05-02 10:19:22 | <biglama> | And I have like 50 nodes in the tree (to do by hand) |
| 2021-05-02 10:19:34 | → | p3n joins (~p3n@217.198.124.246) |
| 2021-05-02 10:19:59 | <biglama> | That's why I though of ditching the input and writing the (rose)tree by hand |
| 2021-05-02 10:20:07 | <biglama> | thought* |
| 2021-05-02 10:20:18 | <locallycompact> | you definitely structured input |
| 2021-05-02 10:20:21 | <locallycompact> | *want |
| 2021-05-02 10:22:33 | × | Rudd0 quits (~Rudd0@185.189.115.103) (Read error: Connection reset by peer) |
| 2021-05-02 10:24:50 | → | Rudd0 joins (~Rudd0@185.189.115.103) |
| 2021-05-02 10:25:30 | → | elliott_ joins (~elliott_@pool-108-18-30-46.washdc.fios.verizon.net) |
| 2021-05-02 10:26:23 | × | p3n quits (~p3n@217.198.124.246) (Quit: ZNC 1.8.2 - https://znc.in) |
| 2021-05-02 10:27:07 | <biglama> | Oh, it may be actually |
| 2021-05-02 10:27:11 | → | p3n joins (~p3n@217.198.124.246) |
| 2021-05-02 10:27:32 | <biglama> | How would I build a cofree then ? |
| 2021-05-02 10:29:46 | <locallycompact> | here's an example of a table of contents with a cofree https://gitlab.com/shakebook-site/shakebook-site.gitlab.io/-/blob/master/Shakefile.hs#L87 |
| 2021-05-02 10:30:02 | <locallycompact> | you just want Cofree [] String |
| 2021-05-02 10:30:40 | <locallycompact> | everything in a rosetree has to have children even if it's empty so all the branches eventually trail with :< [] |
| 2021-05-02 10:31:43 | → | ddellacosta joins (~ddellacos@86.106.143.122) |
| 2021-05-02 10:33:31 | × | v01d4lph4 quits (~v01d4lph4@171.48.62.25) (Remote host closed the connection) |
| 2021-05-02 10:33:34 | → | heatsink joins (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
| 2021-05-02 10:34:14 | <tomsmeding> | locallycompact: biglama: there is also https://hackage.haskell.org/package/containers-0.6.4.1/docs/Data-Tree.html which is just a plain old rose tree :p |
| 2021-05-02 10:35:10 | <locallycompact> | there you g :) |
| 2021-05-02 10:35:17 | <locallycompact> | *go :) |
| 2021-05-02 10:35:43 | <DigitalKiwi> | hi locallycompact |
| 2021-05-02 10:35:51 | <locallycompact> | hi |
| 2021-05-02 10:36:16 | × | coot quits (~coot@37.30.58.122.nat.umts.dynamic.t-mobile.pl) (Quit: coot) |
| 2021-05-02 10:36:31 | × | ddellacosta quits (~ddellacos@86.106.143.122) (Ping timeout: 252 seconds) |
| 2021-05-02 10:37:29 | → | coot joins (~coot@37.30.58.122.nat.umts.dynamic.t-mobile.pl) |
| 2021-05-02 10:37:31 | <biglama> | locallycompact: seems to do the trick nicely and easier to use for me. Thanks ! |
| 2021-05-02 10:38:10 | × | heatsink quits (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 252 seconds) |
| 2021-05-02 10:39:58 | × | ADG1089 quits (~aditya@223.226.237.158) (Quit: Konversation terminated!) |
| 2021-05-02 10:43:29 | × | ukari quits (~ukari@unaffiliated/ukari) (Remote host closed the connection) |
| 2021-05-02 10:43:43 | → | nineonine joins (~nineonine@2604:3d08:7783:f200:10b9:8c10:5b66:dc51) |
| 2021-05-02 10:46:35 | × | stree quits (~stree@68.36.8.116) (Ping timeout: 252 seconds) |
| 2021-05-02 10:46:46 | × | __minoru__shirae quits (~shiraeesh@109.166.57.8) (Ping timeout: 260 seconds) |
| 2021-05-02 10:47:54 | × | nineonine quits (~nineonine@2604:3d08:7783:f200:10b9:8c10:5b66:dc51) (Ping timeout: 245 seconds) |
| 2021-05-02 10:49:29 | → | joncol joins (~jco@c83-248-173-38.bredband.comhem.se) |
| 2021-05-02 10:55:02 | × | Pickchea quits (~private@unaffiliated/pickchea) (Ping timeout: 265 seconds) |
| 2021-05-02 10:56:51 | → | elfets joins (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de) |
| 2021-05-02 10:57:28 | → | nrdmn98 joins (~nrdmn@aufmachen.jetzt) |
| 2021-05-02 10:58:37 | → | ukari joins (~ukari@unaffiliated/ukari) |
| 2021-05-02 10:59:04 | → | stree joins (~stree@68.36.8.116) |
| 2021-05-02 10:59:40 | × | jpds quits (~jpds@gateway/tor-sasl/jpds) (Remote host closed the connection) |
| 2021-05-02 11:00:02 | → | jpds joins (~jpds@gateway/tor-sasl/jpds) |
All times are in UTC.