Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-05-15 20:26:31 ddellacosta joins (~ddellacos@86.106.143.111)
2021-05-15 20:26:43 CrazyPyt_ joins (~crazypyth@206.214.238.6)
2021-05-15 20:29:05 × CrazyPython quits (~crazypyth@206.214.238.6) (Ping timeout: 260 seconds)
2021-05-15 20:29:09 × geekosaur quits (45870322@069-135-003-034.biz.spectrum.com) (Quit: Ping timeout (120 seconds))
2021-05-15 20:30:29 geekosaur joins (45870322@069-135-003-034.biz.spectrum.com)
2021-05-15 20:31:14 × ddellacosta quits (~ddellacos@86.106.143.111) (Ping timeout: 245 seconds)
2021-05-15 20:35:12 notzmv joins (~zmv@unaffiliated/zmv)
2021-05-15 20:37:30 × Aquazi quits (uid312403@gateway/web/irccloud.com/x-mdtoudpfcoqbbopu) (Quit: Connection closed for inactivity)
2021-05-15 20:38:02 × Kaiepi quits (~Kaiepi@47.54.252.148) (Quit: Leaving)
2021-05-15 20:40:52 guest5 joins (5619784f@cpc143846-cosh20-2-0-cust78.6-1.cable.virginm.net)
2021-05-15 20:42:04 × rond_ quits (5940206b@89-64-32-107.dynamic.chello.pl) (Quit: Connection closed)
2021-05-15 20:42:19 star_cloud joins (~star_clou@ec2-34-220-44-120.us-west-2.compute.amazonaws.com)
2021-05-15 20:42:45 × hololeap quits (~hololeap@gateway/tor-sasl/hololeap) (Ping timeout: 240 seconds)
2021-05-15 20:43:05 acidjnk_new joins (~acidjnk@p200300d0c72b95208d2194a61b0d7b67.dip0.t-ipconnect.de)
2021-05-15 20:43:15 <guest5> hi guys, is it possible to convert a string that you've read from a txt file into a custom data type? ive attached the code that reads the file, the output and the data type im trying to convert it into - https://paste.tomsmeding.com/1iMOqn9j
2021-05-15 20:43:47 mst parts (~matthewt@shadowcat/chainsaw-wielder/perl.gc) ()
2021-05-15 20:44:34 usr25 joins (~usr25@unaffiliated/usr25)
2021-05-15 20:45:33 × Rudd0 quits (~Rudd0@185.189.115.108) (Ping timeout: 240 seconds)
2021-05-15 20:46:23 <boxscape> guest 5: converting Strings into data types is called parsing, and since you're deriving Read, that will automatically implement a simple parser for the City type (which is not typically good enough for production purposes but might be good enough for your use case). You should be able to just call `read` on the String you're reading from the file
2021-05-15 20:46:24 <boxscape> to get a value of type [City]
2021-05-15 20:46:35 <sm[m]> hi guest5 . You are automatically deriving a standard Read instance, so the text must be in the standard Read format. "print" a value to see what that looks like (uses Show)
2021-05-15 20:47:12 <sm[m]> if you want to keep your file format, you'll need to write your own Read instance instead of deriving it. Like boxscape said
2021-05-15 20:47:40 <boxscape> oh would Read require it to be in record notation?
2021-05-15 20:48:05 <sm[m]> yes, Read will parse (most) Show output only
2021-05-15 20:48:19 <boxscape> ah, yeah, I missed that part in my response
2021-05-15 20:51:22 <guest5> how would I go about writing my own read instance? I'm very new to Haskell idrk what im doing yet
2021-05-15 20:52:50 × biglama quits (~alex@static-176-165-167-17.ftth.abo.bbox.fr) (Remote host closed the connection)
2021-05-15 20:53:09 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-05-15 20:55:37 × Varis quits (~Tadas@unaffiliated/varis) (Read error: Connection reset by peer)
2021-05-15 20:56:41 <boxscape> guest: The simplest thing right now might be to ignore Read and write a function of type String -> City - as a simple example, if you had `data A = MkA Int String` you could have `readA :: String -> A; readA str = MkA (read el1) (read el2) where [el1, el2] = words str`, see if you can adapt that to City
2021-05-15 20:56:48 <boxscape> guest5, I mean
2021-05-15 20:57:16 × RusAlex quits (~Chel@unaffiliated/rusalex) (Ping timeout: 252 seconds)
2021-05-15 20:57:30 <boxscape> err
2021-05-15 20:57:43 <boxscape> % readA :: String -> A; readA str = MkA (read el1) (read el2) where [el0, el1, el2]
2021-05-15 20:57:43 <yahb> boxscape: ; <interactive>:70:82: error: parse error (possibly incorrect indentation or mismatched brackets)
2021-05-15 20:58:04 <boxscape> % readA :: String -> A; readA str = MkA (read el1) (read el2) where [el0, el1, el2] = words str
2021-05-15 20:58:05 <yahb> boxscape:
2021-05-15 20:58:19 ddellacosta joins (ddellacost@gateway/vpn/mullvad/ddellacosta)
2021-05-15 20:58:26 <boxscape> % readA "A 24 \"test\""
2021-05-15 20:58:26 <yahb> boxscape: ; <interactive>:73:1: error:; * No instance for (Show A) arising from a use of `print'; * In a stmt of an interactive GHCi command: print it
2021-05-15 20:59:17 <boxscape> % readA "A 24 \"test\""
2021-05-15 20:59:17 <yahb> boxscape: MkA 24 "test"
2021-05-15 20:59:41 <boxscape> (I fixed A by redefining it to yahb in a private message, so now it works)
2021-05-15 21:00:22 xcmw joins (~textual@2603-6011-2200-f103-1090-4073-ea46-f74d.res6.spectrum.com)
2021-05-15 21:00:25 <boxscape> note I added el0 in the definition, I forgot that at first
2021-05-15 21:02:58 × 5EXAAFHD7 quits (~tromp@dhcp-077-249-230-040.chello.nl) (Read error: Connection reset by peer)
2021-05-15 21:03:06 × ddellacosta quits (ddellacost@gateway/vpn/mullvad/ddellacosta) (Ping timeout: 252 seconds)
2021-05-15 21:03:34 tromp joins (~tromp@dhcp-077-249-230-040.chello.nl)
2021-05-15 21:03:50 × justsomeguy quits (~justsomeg@unaffiliated/--/x-3805311) (Quit: WeeChat 3.0.1)
2021-05-15 21:04:12 <guest5> got it im giving it a go
2021-05-15 21:06:43 × LKoen quits (~LKoen@2a01cb0407597a0030b702bc5b5d599b.ipv6.abo.wanadoo.fr) (Quit: “It’s only logical. First you learn to talk, then you learn to think. Too bad it’s not the other way round.”)
2021-05-15 21:15:50 × takuan quits (~takuan@178-116-218-225.access.telenet.be) (Remote host closed the connection)
2021-05-15 21:20:32 RusAlex joins (~Chel@unaffiliated/rusalex)
2021-05-15 21:23:32 × Gurkenglas quits (~Gurkengla@unaffiliated/gurkenglas) (Ping timeout: 240 seconds)
2021-05-15 21:23:59 × danso quits (~dan@modemcable156.91-20-96.mc.videotron.ca) (Quit: WeeChat 3.0)
2021-05-15 21:24:07 × lawid quits (~quassel@2a02:8109:b5c0:5334:265e:beff:fe2a:dde8) (Ping timeout: 260 seconds)
2021-05-15 21:25:51 × elfets quits (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de) (Ping timeout: 260 seconds)
2021-05-15 21:26:11 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 240 seconds)
2021-05-15 21:26:44 Kaiepi joins (~Kaiepi@47.54.252.148)
2021-05-15 21:29:23 × guest5 quits (5619784f@cpc143846-cosh20-2-0-cust78.6-1.cable.virginm.net) (Quit: Ping timeout (120 seconds))
2021-05-15 21:29:38 × Putonlalla quits (~sapekiis@it-cyan.it.jyu.fi) (Ping timeout: 240 seconds)
2021-05-15 21:33:15 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2021-05-15 21:35:29 lawid joins (~quassel@ip5b41db4a.dynamic.kabel-deutschland.de)
2021-05-15 21:36:56 TK__ joins (~cinch@2601:1c0:5201:2100:9992:f75f:4988:2a3c)
2021-05-15 21:36:59 × Guest70586 quits (~alexander@ppp-94-67-202-54.home.otenet.gr) (Ping timeout: 268 seconds)
2021-05-15 21:37:44 olligobber joins (olligobber@gateway/vpn/privateinternetaccess/olligobber)
2021-05-15 21:38:20 × oxide quits (~lambda@unaffiliated/mclaren) (Ping timeout: 265 seconds)
2021-05-15 21:38:34 ddellacosta joins (~ddellacos@86.106.143.241)
2021-05-15 21:39:34 × sheepduck quits (~sheepduck@2607:fea8:2a60:b700::5e97) (Ping timeout: 245 seconds)
2021-05-15 21:39:37 × chris__ quits (~chris@81.96.113.213) (Remote host closed the connection)
2021-05-15 21:39:53 × lawid quits (~quassel@ip5b41db4a.dynamic.kabel-deutschland.de) (Client Quit)
2021-05-15 21:40:57 × usr25 quits (~usr25@unaffiliated/usr25) (Read error: Connection reset by peer)
2021-05-15 21:41:09 lawid joins (~quassel@ip5b41db4a.dynamic.kabel-deutschland.de)
2021-05-15 21:43:21 × ddellacosta quits (~ddellacos@86.106.143.241) (Ping timeout: 260 seconds)
2021-05-15 21:43:29 dmytrish joins (~mitra@2a02:8084:a82:d900:15f6:9568:8f96:9a44)
2021-05-15 21:44:39 pfurla joins (~pfurla@247.15.195.173.client.static.strong-in52.as13926.net)
2021-05-15 21:45:39 × __monty__ quits (~toonn@unaffiliated/toonn) (Quit: leaving)
2021-05-15 21:47:11 × pfurla_ quits (~pfurla@ool-182ed2e2.dyn.optonline.net) (Ping timeout: 240 seconds)
2021-05-15 21:47:26 × olligobber quits (olligobber@gateway/vpn/privateinternetaccess/olligobber) (Ping timeout: 260 seconds)
2021-05-15 21:48:11 × heatsink quits (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection)
2021-05-15 21:51:33 × lawid quits (~quassel@ip5b41db4a.dynamic.kabel-deutschland.de) (Quit: No Ping reply in 180 seconds.)
2021-05-15 21:52:51 lawid joins (~quassel@ip5b41db4a.dynamic.kabel-deutschland.de)
2021-05-15 21:53:21 × nicholasbulka quits (~nicholasb@2601:900:4301:da0:75d5:f759:9c55:c828) (Remote host closed the connection)
2021-05-15 21:53:37 heatsink joins (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net)
2021-05-15 21:54:02 nicholasbulka joins (~nicholasb@2601:900:4301:da0:75d5:f759:9c55:c828)
2021-05-15 21:54:23 afznvzan joins (4c0ef7dd@76-14-247-221.or.wavecable.com)
2021-05-15 21:55:45 nicholas_ joins (~nicholasb@2601:900:4301:da0:8c8b:ebd7:353b:3970)
2021-05-15 21:56:39 lawid_ joins (~quassel@91.65.233.2)
2021-05-15 21:57:05 ddellaco_ joins (~ddellacos@ool-44c73afa.dyn.optonline.net)
2021-05-15 21:58:19 × nicholasbulka quits (~nicholasb@2601:900:4301:da0:75d5:f759:9c55:c828) (Ping timeout: 245 seconds)
2021-05-15 21:58:30 × dmytrish quits (~mitra@2a02:8084:a82:d900:15f6:9568:8f96:9a44) (Quit: Konversation terminated!)
2021-05-15 21:58:37 dmytrish_ joins (~mitra@37.228.247.154)
2021-05-15 21:59:51 × mrus quits (~mrus@2001:19f0:5:3fd4:5400:3ff:fe48:1820) (Quit: Surfing the great wave off Kanagawa)
2021-05-15 22:00:07 × nicholas_ quits (~nicholasb@2601:900:4301:da0:8c8b:ebd7:353b:3970) (Ping timeout: 250 seconds)
2021-05-15 22:00:17 mrus joins (~mrus@149.28.61.155)
2021-05-15 22:01:02 × lawid quits (~quassel@ip5b41db4a.dynamic.kabel-deutschland.de) (Ping timeout: 268 seconds)
2021-05-15 22:01:16 hololeap joins (~hololeap@gateway/tor-sasl/hololeap)
2021-05-15 22:02:59 × ddellaco_ quits (~ddellacos@ool-44c73afa.dyn.optonline.net) (Ping timeout: 265 seconds)
2021-05-15 22:03:49 × stree quits (~stree@68.36.8.116) (Ping timeout: 252 seconds)
2021-05-15 22:04:20 Rudd0 joins (~Rudd0@185.189.115.103)

All times are in UTC.